Templates challenge the classic compiler-plus-linker model. Therefore there are different approaches to organize template code: the inclusion model, explicit instantiation, and the separation model.
Usually, you should use the inclusion model (that is, put all template code in header files).
By separating template code into different header files for declarations and definitions, you can more easily switch between the inclusion model and explicit instantiation.
The C++ standard defines a separate compilation model for templates (using the keyword export ). It is not yet widely available, however.
Debugging code with templates can be challenging.
Template instances may have very long names .
To take advantage of precompiled headers, be sure to keep the same order for #include directives.