OVH Cloud OVH Cloud

template compilation problem

2 réponses
Avatar
Allen Conway
g++ 3.4.0 ne compile pas le suivant:

template <class X> struct Xmap
{
map<string,X>::const_iterator Begin()const
{
return mXmap.begin();
}

map<string,X> mXmap;
};

::::::::::::::: error: expected ';' before "Begin"

Est-ce parce que (1) je fais une erreur de syntaxe (2) C++ ne permet pas
d'écrire ça (3) il y a un problème avec cette version du compilateur

2 réponses

Avatar
Falk Tannhäuser
Allen Conway wrote:
g++ 3.4.0 ne compile pas le suivant:

template <class X> struct Xmap
{
map<string,X>::const_iterator Begin()const


typename map<string,X>::const_iterator Begin() const

Falk

Avatar
Allen Conway
Que je suis bête! C'est comme parler une langue étrangère - il y a toujours
des règles de grammaire qu'on oublie dans un moment de panique... merci++!

"Falk Tannhäuser" wrote in message
news:cut754$mnu$
Allen Conway wrote:
g++ 3.4.0 ne compile pas le suivant:

template <class X> struct Xmap
{
map<string,X>::const_iterator Begin()const


typename map<string,X>::const_iterator Begin() const

Falk