The cheap easy solution is to put the template implemtation in another header and just #include it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// mytemplate.h
#ifndef MYTEMPLATE_H_INCLUDED
#define MYTEMPLATE_H_INCLUDED
template <typename T>
class MyTemplate
{
T AFunction();
};
#include "mytemplate.hpp"
#endif // MYTEMPLATE_H_INCLUDED
1 2 3 4 5 6 7 8 9 10 11 12
// mytemplate.hpp
// looks just like a cpp file, but it isn't
#include "whatever.h"
#include "whateverelseyouneed.h"
#include "mytemplate.h" // superfluous, but harmless
template <typename T>
T MyTemplate<T>::AFunction()
{
// ...
}