I searched a bit couldnt find an answer to this exact query.
I will directly show what I need , using code
template<typename T1,typename T2>
class C1
{
private:
void foo(T1 a,T1 b)
{
//implementation
}
}
Now I need to specialize foo when T1 is std::string and T2 is of any type , I tried like below and it doesnt seem to work
template<typename T2>
void C1<std::string,typename T2>::foo(std::string a,std::string b)
{
//something different implementation
}
So is this allowed as per standards? and if yes how to achieve it? if no what is the best way to do it?
Edit : The error reported by the compiler is as below
/tmp/P9Vp19KuKH.cpp:28:32: error: template argument 2 is invalid
28 | void C1<std::string,typename T2>::foo(std::string a,std::string b)
| ^