I have templated class which has a function (myfunc()
) which does the same on every case of T
except some cases (eg. bool
). I have a working solution, based on this question:
template <class T> class opt_arg{
private: void myfunc(){
/*Do generic stuff */
}
/* Can I insert here the bool specialization? */
};
/* The specialization "inserted outside of the class body": */
template<>
inline void opt_arg<bool>::myfunc(){
/* Do bool specific stuff*/
}
As I have mentioned, it is working fine. I am just wondering, that can I insert the function specialization inside the "class body"?