P
pascal.cathier
Is it possible to fully specialize a template member function? If not,
why is that so? The following code fails to compile with GCC:
class A
{
public:
template < typename T >
void foo() {}
template <>
void foo<int>() {}
};
int main(int argc, char * argv[])
{
A a;
a.foo<void>();
a.foo<int>();
}
I can still wrap these functions 'foo' as the operator() of a template
class that I can then specialize to achieve the same goal, but I would
rather not if I can avoid to.
Thanks
B.
why is that so? The following code fails to compile with GCC:
class A
{
public:
template < typename T >
void foo() {}
template <>
void foo<int>() {}
};
int main(int argc, char * argv[])
{
A a;
a.foo<void>();
a.foo<int>();
}
I can still wrap these functions 'foo' as the operator() of a template
class that I can then specialize to achieve the same goal, but I would
rather not if I can avoid to.
Thanks
B.