Bonjour,
Mon probleme est surement bete, mais je suis un peu rouillé en C++ et j'ai pas encore le reflexe de retrouver la petite bete.
Je déclare un const_iterator sur une map :
Et je me paye l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part std::map<std::string, NODE*>::const_iterator f;
Donc je suis bien embeté.dependent-name ` std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >,NODE*,std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, NODE*> > >::const_iterator' is parsed as a non-type, but instantiation yields a type
Je vous met le code de toute la fonction :
Voila, si qqun peut m'expliquer ce qui ne vas pas, ce que j'ai fait de mal, etc, ça serait vraiment gentil, merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 template <class LINK, class NODE, class INSERTER> std::istream& readLinks(std::istream &i, INSERTER ins, const std::map<std::string, NODE*> &where) { int j = 0; int num = 0; LINK *l = 0; NODE *from = 0; NODE *to = 0; std::string s; std::string t; std::map<std::string, NODE*>::const_iterator f; i >> num; for (j = 0; j < num; j++) { i >> s >> t; l = new LINK(); l->readFrom(i); f = where.find(s); if (f == where.end()) from = 0; else from = (*f).second; f = where.find(t); if (f == where.end()) to = 0; else to = (*f).second; attach(from, to, l); ins(l); } return i; }
Partager