I have a variety of textbooks that note that there wasn't a hash container originally incorporated into the STL, but most also say that most standard library implementations do have some form of hash container since it was a known shortfall.
These books aren't necessarily as up to date as possible, and I got a little confused about what was really "standard" when googling, so:
At this point in time, do most standard library implementations provide a fairly consistent hash container, and if so, is it considered a part of the STL?
What's the "standard" header for this container? (I'm guessing it's #include <hash>, but just in case!).
Is there a hash set and hash map separately defined for use?
The new standard hash map container is called unordered_map. You can include it in your files by #include <unordered_map>. It is part of the now-approved standard C++11.
Before C++11, you had various things like hash_map which were (widely?) supported by some vendors so you could use them, but if you did, your code wasn't really portable because hash_map wasn't part of the standard. hash_map and all the other vendor-specific versions of a hash table structure shouldn't be used now.
See C++11 types:
unordered_mapunordered_setunordered_multimapunordered_multisetIf 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