An explicit specialization of a class template is like a regular class (it is fully instantiated, so it is not a parametric type). Therefore, you do not need the outer template<>
:
// template<> <== NOT NEEDED: A<1> is just like a regular class
template<> // <== NEEDED to explicitly specialize member function template Fun()
void A<1>::Fun<int>()
{
/* some code here. */
}
Similarly, if your member function Fun
were not a function template, but a regular member function, you would not need any template<>
at all:
template<>
struct A<1>
{
void Fun();
};
void A<1>::Fun()
{
/* some code here. */
}