S
Simon G Best
Hello!
I have a query regarding explicit specialisation of class templates
which are themselves members of class templates.
Here's what I want to do:
template< class T > struct pink {
template< class U > struct floyd;
};
template< class T > template< class U >
struct pink<T>::floyd {
pink seamus();
U eugene();
};
/* Here's the specialisation I'm wondering
about (with line numbers given in
comments on the left): */
template< class T >
/*19*/ struct pink<T>::floyd<int> {
/*21*/ pink seamus();
float eugene();
};
Comeau's online compiler does fine with that but GCC 3.2.3 does not
:-( Instead, g++ says:
[source file]:19: template parameters not used in partial
specialization:
[source file]:19: `T'
[source file]:21: syntax error before `(' token
However, I can get it to (sort of) work if I change the specialisation
definition to:
template< class T >
struct pink<T>::floyd<int> {
pink<T> seamus();
float eugene();
};
though it still warns about T being an unused template parameter.
I'd just like to confirm my suspicion that GCC 3.2.3 is incorrect on
this, and that the original version of my code is correct
Thank you!
Simon
I have a query regarding explicit specialisation of class templates
which are themselves members of class templates.
Here's what I want to do:
template< class T > struct pink {
template< class U > struct floyd;
};
template< class T > template< class U >
struct pink<T>::floyd {
pink seamus();
U eugene();
};
/* Here's the specialisation I'm wondering
about (with line numbers given in
comments on the left): */
template< class T >
/*19*/ struct pink<T>::floyd<int> {
/*21*/ pink seamus();
float eugene();
};
Comeau's online compiler does fine with that but GCC 3.2.3 does not
:-( Instead, g++ says:
[source file]:19: template parameters not used in partial
specialization:
[source file]:19: `T'
[source file]:21: syntax error before `(' token
However, I can get it to (sort of) work if I change the specialisation
definition to:
template< class T >
struct pink<T>::floyd<int> {
pink<T> seamus();
float eugene();
};
though it still warns about T being an unused template parameter.
I'd just like to confirm my suspicion that GCC 3.2.3 is incorrect on
this, and that the original version of my code is correct
Thank you!
Simon