I have a class Foo which is used in a small standalone project. It has a class definition in Foo.h with the implementation for the class\' member functions in an implementat
The template method definition should indeed be in the header file of it the class it belongs to.
Like this:
class MyClass
{
template
void foo(const T&)
{
// Definition
}
};
Or like this (note that the template method definition can be included from separate file after the class declaration)
class MyClass
{
template void foo(const T&);
};
template
void MyClass::foo(const T&)
{
// Definition
}
The rest is depends on the style you agreed on and your needs.
I would put the functor declaration (or even the definition if they are simple) into the header if I use them not only in Foo or if Foo has them as class member.