On Jan 23, 10:55 pm, dbtouch <dbto...@gmail.com> wrote: > Dear G++ Users, > > I am using g++ (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) and I > cannot use hash_map with std::string as key type. Here is the test > program I have: > > #include <string> > #include <ext/hash_map> > using namespace __gnu_cxx; > > typedef hash_map<std::string, int> MyHashTyp; > > int main() { > MyHashTyp map; > MyHashTyp::iterator itr; > > itr=map.find(std::string("hello")); > return 1; > > } > > The compiler reported error as: > > strhashmap.cpp:11: instantiated from here > /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ > ext/hashtable.h:596: error: no match for call to â(const > __gnu_cxx::hash<std::basic_string<char, std::char_traits<char>, > std::allocator<char> > >) (const std::basic_string<char, > std::char_traits<char>, std::allocator<char> >&)â > make: *** [strhashmap.o] Error 1 > > When I change key type to char, it compiles. Can you help me on this? > > Thanks and Happy Chinese New Year! > > dbtouch
I got the answer from the group. Thanks, Ben. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus