Template specialization of a single method from a templated class

As with simple functions you can use declaration and implementation.
Put in your header declaration:

template <>
void TClass<int>::doSomething(std::vector<int> * v);

and put implementation into one of your cpp-files:

template <>
void TClass<int>::doSomething(std::vector<int> * v) {
 // Do somtehing with a vector of int's
}

Don’t forget to remove inline (I forgot and thought this solution will not work 🙂 ).
Checked on VC++2005

Leave a Comment