Suppose I write a class as follows:
As you could see, test is a template member. Now, I'd like to make a special version of test to handle arguments of type int (test<int>) no matter how the template class have_a_try is instantiated, that's, no matter have_a_try is instantiated for type int, double, string... if the actual arguments passed to that instance is of type int, the specialized version of test is called. I've tried the following code but failed.
template <class T1>
template <class T2>
T2 test( const T2&, const T2& );
T2 have_a_try<T1>::test( const T2& a, const T2& b )
One of my friend asked me this question just now but I still cannot solve it. I guess it's impossible to make a specialized version of a member template while leaving the class template generic.
int have_a_try<T1>::test<int>( const int& a, const int& b )
Dear all, please help me.