简体   繁体   English

hash_map和stdext :: hash_map?

[英]hash_map and stdext:: hash_map?

Under the visual C++, we have " hash_map" and "hash_set". 在visual C ++下,我们有“hash_map”和“hash_set”。 In g++, we have " stdext::hash_map" and " stdext::hash_set". 在g ++中,我们有“stdext :: hash_map”和“stdext :: hash_set”。 Is there any difference in terms of their respective performance or other factors? 各自的表现或其他因素有什么不同吗?

None of those are standards. 这些都不是标准。 They were just there to fill a need. 他们只是满足需求。 Concerning the performances, I have no idea, but I guess they're really similar. 关于表演,我不知道,但我猜他们真的很相似。

What existed in TR1, and will be included in C++1X is unordered_map and unordered_set They say they changed the name to avoid any confusion with previous non-standard implementations. TR1中存在的,将包含在C ++ 1X中的是unordered_map和unordered_set他们说他们更改了名称以避免与以前的非标准实现混淆。

http://www2.research.att.com/~bs/C++0xFAQ.html#std-unordered http://www2.research.att.com/~bs/C++0xFAQ.html#std-unordered

As Tristram points out, the standard is (or will be) unordered_map. 正如Tristram指出的那样,标准是(或将是)unordered_map。 How to get it is a little confusing. 怎么弄它有点混乱。 Probably the best way going forward is: 可能最好的方法是:

#include <unordered_map>

int main() {
    std::unordered_map<int,int> m;
}

and with g++ compile with the C++0X switch: 并使用C ++ 0X开关编译g ++:

g++ -std=c++0x mymap.cpp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM