I can find plenty of help with partial specialisation of templated classes, but I want to partially specialise a method of a non-templated class.
class TempMembMeth {
public:
template<typename T1, typename T2>
void templMethod1(int);
};
My templated method implementation:
template<typename T1, typename T2>
void TempMembMeth::templMethod1(int){
std::cout << "<T1,T2>templMethod1(int)" << '\n';
}
I can fully spec the method OK:
template<>
inline void TempMembMeth::templMethod1<char,char>(int){
std::cout << "<char,char>templMethod1(int)" << '\n';
}
But how can I do a partial specification?
template<typename T2>
inline void TempMembMeth::templMethod1<char,T2>(int){
std::cout << "<char,?>templMethod1(int)" << '\n';
}
I get: 'TempMembMeth::templMethod1' : illegal use of explicit template arguments I can't re-define the class with the partially specialised method, since the class is not templated. Neither will it let me "overload" the templated method within the class - again it complains of illegal use of explicit template arguments.
So any ideas if this is possible? For the moment I have worked arround it by templating the class, but I wondered if this were possible without a templated class.