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?
Hashtable FeaturesIt does not accept duplicate keys. It stores key-value pairs in hash table data structure which internally maintains an array of list. Each list may be referred as a bucket. In case of collisions, pairs are stored in this list.
Yes, hash_map is part of the STL. However, it is not part of C++03's standard library.
Internally unordered_map is implemented using Hash Table, the key provided to map are hashed into indices of a hash table that is why the performance of data structure depends on hash function a lot but on an average, the cost of search, insert and delete from the hash table is O(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.
Usage is almost the same as with a std::map.
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 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With