Specialization of template member function of template class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux