问题
Possible Duplicates:
Hashtable in C++?
can anybody offer a simple hash_map example in C++?
Does the STL contain an implementation of a hashtable?
If so, can you provide a brief example of how to use it?
回答1:
Current standard implementation doesn't, STL::TR1 does, see Unordered Map.
Most modern compilers have a TR1 implementation, if that fails, you may always use the Boost TR1 implementation.
- MSVC has it for VS2008 via service pack 1
- GCC has it shipped with 4.x, but you can make it work with 3.4.x too AFAIR
Usage is almost the same as with a std::map.
回答2:
While not officially part of the STL standard, hash_map and hash_set are commonly used to improve searching times......
http://msdn.microsoft.com/en-us/library/0d462wfh%28VS.80%29.aspx
So, long story short--no .
回答3:
A quick google came up with this description of hash_map.
来源:https://stackoverflow.com/questions/2192976/does-the-stl-contain-a-hashtable