Well, you cannot. At least it isn't intended by language creators.
It is simple if you understand how C++ separate compilation works. When you compiling your cpp file, compiler does not know which T you are using and what code it should generate.
You can separate them. The trick is to use an file extension that the compiler does not identify as a compiler unit (such as .tpp). Then the .tpp (or whatever you choose) can be safely included.
Array.cpp, Line 45, the return value must be Array<T>&. Also Array.h, line 15.
I agree with coder777. If you want to separate the header and the instantiation of the template code, change the name of Array.cpp to Array.tpp, and add include "Array.tpp" at line 18 of Array.h. Because of the include guards in Array.h, it won't matter whether Array.tpp includes Array.h or not.
> Well, you cannot.
> It is simple if you understand how C++ separate compilation works.
> When you compiling your cpp file, compiler does not know which T you are using and what code it should generate.
So if you just say which T may be used, you can separate it.
See explicit template instantiation http://www.cplusplus.com/forum/articles/14272/