tags:

views:

297

answers:

3

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?

+3  A: 

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.

Kornel Kisielewicz
A: 

A quick google came up with this description of hash_map.

Maurits Rijk
I guess this was down voted because hash_map is not standard.
Maurits Rijk
I didn't downvote you, but in future please provide a sentence or two explaining what "this" links to.
anon
Point taken. Changed link.
Maurits Rijk
+2  A: 

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 .

Paperino