int main (int argc, char** argv)
{
hash_map<int, string> test;
hash_map<int, string, hash(int)> test1;
hash_map<int, string, hash(int), eqint> test2;
return 0;
}
--------
et a la compilation :
g++ testHashMap.cpp
testHashMap.cpp: In function 'int main(int, char**)':
testHashMap.cpp:16: error: 'hash_map' was not declared in this scope
testHashMap.cpp:16: error: expected primary-expression before 'int'
testHashMap.cpp:16: error: expected `;' before 'int'
testHashMap.cpp:17: error: expected primary-expression before 'int'
testHashMap.cpp:17: error: expected `;' before 'int'
testHashMap.cpp:18: error: expected primary-expression before 'int'
testHashMap.cpp:18: error: expected `;' before 'int'
(g++ --version
g++ (GCC) 4.0.1 (4.0.1-5mdk for Mandriva Linux release 2006.0))
J'imagine que ce doit être trivial, mais je ne vois pas ou est l'erreur ...
Mais quand j'utilise <hash_map>, il me dit fichier introuvable ...
Franck Branjonneau wrote:
"C.B." écrivait:
je souhaite utiliser une hah_map dans un projet.
#include <ext/hash_map>
Ce n'est pas un entête standard, mais une extension g++. hash_map est dans le namespace __gnu_cxx.
C.B.
J'ai modifié mon source pour que ça marche. Mais, hash_map<const char*, int, hash<const char*>, eqstr> months marche bien (exemple de sgi), alors que hash_map<const string, int, hash<const string>, eqstri> test me fait une liste d'erreurs bien imbuvable.
merci g++, c'est tout de suite plus clair. Qqn aurait une idée ?
J'ai modifié mon source pour que ça marche. Mais, hash_map<const char*, int,
hash<const char*>, eqstr> months marche bien (exemple de sgi), alors que
hash_map<const string, int, hash<const string>, eqstri> test me fait une
liste d'erreurs bien imbuvable.
J'ai modifié mon source pour que ça marche. Mais, hash_map<const char*, int, hash<const char*>, eqstr> months marche bien (exemple de sgi), alors que hash_map<const string, int, hash<const string>, eqstri> test me fait une liste d'erreurs bien imbuvable.