This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Specialization of template member function of template class
- From: "Christian Lessig" <christian dot lessig at igd dot fraunhofer dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 30 Apr 2005 11:29:43 +0200
- Subject: Specialization of template member function of template class
Hi,
I want to specialize a template member function of a template class.
template<class T>
struct B {
template< unsigned int Nums>
void func();
};
template<class T>
template< unsigned int Nums>
void
B<T>::func() {
// do sth. useful
}
template<class T>
template<>
void
class B<T>::func<3>() {
// do sth. else
}
Under Windows, the .NET 2003 C++ compiler accepts the code but the gcc
3.4.0 rejects it with the following error:
main.cpp:45: error: invalid explicit specialization before '>' token
main.cpp:45: error: enclosing class templates are not explicitly specialized
main.cpp:47: error: expected identifier before '(' token
main.cpp:47: error: expected unqualified-id before ')' token
main.cpp:47: error: expected `;' before '{' token
Is this an issue of the gcc compiler or is the .NET compiler not C++
standard compliant in this case?
Regards,
Christian