Hi, I am trying to use the ext/hash_map of gnu C++, but I observe some strange behaviors, please help me, my code is :
#include <iostream> #include <cstring> #include <ext/hash_map> using namespace std; using namespace __gnu_cxx; class SE { public: bool operator ()(const char *a, const char *b); }; bool SE::operator ()(const char *a, const char *b) { return strcmp(a, b); } int main(int argc, char **argv) { hash_map<const char *, int, hash<const char *>, SE> map; map["abc"] = 1; map["ab"] = 10; cout << map["abc"] << endl << map["ab"] << endl << map["d"] << endl;; return 0; } ------------------------ But to my surprise, all the three map["..."] output is '0', I am wondering, is there any place I am writing wrong code? Thanks! Regards! Bo _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus