I just noticed that std::map
and std::set
have the member function equal_range()
returning an iterator range of values for a certain key. How does this make sense when std::map
and std::set
are always ordered key/value (as in a single key for a single value, or both combined) containers.
I would expect this member function with std::multimap
and std::multiset
since both of these allow for multiple values sharing the same key, and of course they both do. What am I missing?
equal_range
should return instead, and why? More importantly, why should the quoted fact influence whatequal_range
returns? – Petulais_transparent
lookups: godbolt.org/z/b5nqvKf8o (Though obv this isn't the initial reason it was available before C++14) – Lipocaic