Template specialization problem
Ryszard Kabatek
Ryszard.Kabatek@softax.pl
Tue May 8 00:57:00 GMT 2001
In the sample below I get the folowing error message:
spec.cc:30: template-id `toType<>' for `char X<char>::toType(int)' does
not
match any template declaration
spec.cc:30: syntax error before `{' token
Is it a compiler bug or I misunterstod something?
Regards
--
Ryszard Kabatek
template<typename T>
struct X {
typedef T type;
typedef T itype;
static type toType(itype i);
static itype toItype(type c) {return static_cast<itype>(c);}
};
template<>
struct X<char> {
typedef char type;
typedef int itype;
static type toType(itype i);
static itype toItype(type c) {return static_cast<itype>(c);}
};
template<typename T>
X<T>::type
X<T>::toType(itype i)
{
return static_cast<type>(i);
}
template<>
X<char>::type
X<char>::toType(itype i)
{
return static_cast<type>(i);
}
More information about the Gcc
mailing list