M
Martin
I'm trying to make a partial specialization of a class of mine. Can
someone please tell me what's wrong with the following code? GCC gives
me the error "invalid use of undefined type "class X<int, B>"".
template <class A, class B>
class X
{
public:
void f();
};
template <>
void X<int, int>::f()
{ cout << "int-int";}
template <class B>
void X<int, B>::f() //error on this line
{ cout << "int-B"; }
int main( int argc, char** argv )
{
X<int, double> x;
x.f();
return 0;
}
someone please tell me what's wrong with the following code? GCC gives
me the error "invalid use of undefined type "class X<int, B>"".
template <class A, class B>
class X
{
public:
void f();
};
template <>
void X<int, int>::f()
{ cout << "int-int";}
template <class B>
void X<int, B>::f() //error on this line
{ cout << "int-B"; }
int main( int argc, char** argv )
{
X<int, double> x;
x.f();
return 0;
}