C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Probleme de specialisation de methode template dans une clas

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French)
View previous topic :: View next topic  
Author Message
cpoupon@toto.cea.fr
Guest





PostPosted: Mon May 30, 2005 1:43 pm    Post subject: Probleme de specialisation de methode template dans une clas Reply with quote



Bonjour,

quelqu'un peut-il me dire la syntaxe a adopter pour que
le code suivant fonctionne a la fois sur gcc3 et gcc4
sans avoir a utiliser de #ifdef
Ce code compile sur gcc4, mais sur gcc3, il faut
supprimer un des "template <>" de la specialisation
pour que ca compile, sous peine d'avoir le message
d'erreur suivant:

example.cc: In instantiation of `A<int>':
example.cc:26: instantiated from here
example.cc:26: too many template parameter lists in declaration of
`A<int>::Axis'


Merci pour votre aide,

Cyril



-------------------------------------------------------------------------

#include <iostream>


template < class T >
class A
{

public:

enum Axis
{
X_AXIS
};

template < class U > void foo( U u, Axis axis );

};

template < class T > template < class U >
void A< T >::foo( U u, A< T >::Axis axis )
{
}


template <> template <>
void A< int >::foo< int >( int u, A< int >::Axis axis )
{
}


int main()
{

A< int > a;

a.foo< int >( ( int )1, A< int >::X_AXIS );

return 1;

}

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (French) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.