On www.CPlusPlus.com, it states the following for unordered_multimap,
Elements with equivalent keys are grouped together in the same bucket and in such a way that an iterator (see equal_range) can iterate through all of them.
I know we cannot infer this from that statement, but I'd like to know if a given bucket only contains elements with the equivalent keys?
Here are the only pertinent requirements:
[C++11: 23.2.5/5]:Two valuesk1andk2of typeKeyare considered equivalent if the container’skey_equalfunction object returns true when passed those values. Ifk1andk2are equivalent, the hash function shall return the same value for both. [..]
[C++11: 23.2.5/8]:The elements of an unordered associative container are organized into buckets. Keys with the same hash code appear in the same bucket. [..]
There is nothing prohibiting all elements with key hash a and all elements with key hash b from being stored in the same bucket. It is up to the standard library implementation that you use as to whether or not this fact is used.
No standard wording exists to make this explicit; it's defined by omission.
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