Question: So, I heard that C++ templates shouldn't be separated into a header (.h) and source (.cpp) files.

For instance, a template like this:

```
template <class T>
class J
{   
   T something;
};

```

Is this true? Why is it so?

If because of that I'm gonna have to put both declaration and implementation in the same file, should I put it in a .h file or a .cpp file?

Answer: 
Headers.

It's because templates are instantiated at compile-time, not link-time, and different translation units (roughly equivalent to your `.cpp` files) only "know about" each other at link-time. Headers tend to be widely "known about" at compile-time because you `#include` them in any translation unit that needs them.

Read <https://isocpp.org/wiki/faq/templates> for more.
Yes, it's true. Declaration and implementation are generally put into the header file all together. Some compilers experimented with an `export` keyword that would allow them to be separated, but that has been removed from C++0x. Check out [this FAQ entry](http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12) for all the dirty details.