2013-09-16 29 views
0

這裏是我的「程序」中的一員:錯誤:「的hash_map」不是「性病」

#include <string> 
#include <ext/hash_map> 

int main() 
{ 
    std::hash_map<std::string, int> myMap; 
} 

我試圖與紅帽G ++編譯它。有人可以解釋爲什麼編譯器抱怨:

error: 'hash_map' is not a member of 'std'

+0

請參閱:http://stackoverflow.com/questions/5908581/is-hash-map-part-of-the-stl – 1FpGLLjZSZMx6k

回答

1

的的hash_map中處於不同的命名空間,即__gnu_cxx::hash_map。 哈希映射的更新版本是std::tr1::unordered_map或自C++ 11 std::unordered_map