我想訪問C++ hash_map的散列值。我想:如何獲取散列值,C++ hash_map
__gnu_cxx::hash_map<string, int> my_table;
const hash<string> hh = my_table.hash_funct();
string s("hello");
size_t j = hh(s);
最後一行將無法編譯:
no match for call to '(const __gnu_cxx::hash<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >) (std::string&)
所以,很顯然,我不知道如何使用散列器功能。如果有人有小費,將不勝感激。
這是從古老的STL庫,在http://www.sgi.com/tech/記錄stl和'hash'只有一個模板參數。 –