Does the STL contain a hashtable? [duplicate]

懵懂的女人 提交于 2019-12-09 14:31:00

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!