"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:UfXlc.24994$_41.1789783@attbi_s02
"Dave" <be***********@yahoo.com> wrote...
Hello all,
I am trying to create a full specialization of a member function
template of a class template. I get the following errors:
Line 29: 'foo<T1>::bar' : illegal use of explicit template arguments
Line 29: 'bar' : unable to match function definition to an existing
declaration
What am I doing wrong?
It is expressly prohibited. If you want to explicitly specialise
a member template, the enclosing class has to be specialised as well.
See 14.7.3/17.
In this case a workaround is to add the specialised member function to the
class declaration:
template <typename T1>
class foo
{
public:
template <typename T2>
void bar(const T2 ¶m);
void bar(const double ¶m);
};
template <typename T1>
void foo<T1>::bar(const double ¶m)
{
static_cast<void>(param);
cout << "Point 2" << endl;
}
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)