views:

111

answers:

2

Under the visual C++, we have " hash_map" and "hash_set". In g++, we have " stdext::hash_map" and " stdext::hash_set". Is there any difference in terms of their respective performance or other factors?

+2  A: 

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.

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

Tristram Gräbener
+1  A: 

As Tristram points out, the standard is (or will be) 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:

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