Namespaces
Variants
Actions

std::unordered_multimap

From cppreference.com
< cpp‎ | container
 
 
 
 
Defined in header <unordered_map>
template<

    class Key,
    class T,
    class Hash = std::hash<Key>,
    class KeyEqual = std::equal_to<Key>,
    class Allocator = std::allocator<std::pair<const Key, T>>

> class unordered_multimap;
(1) (since C++11)
namespace pmr {

    template<
        class Key,
        class T,
        class Hash = std::hash<Key>,
        class Pred = std::equal_to<Key>
    > using unordered_multimap =
          std::unordered_multimap<Key, T, Hash, Pred,
              std::pmr::polymorphic_allocator<std::pair<const Key, T>>>;

}
(2) (since C++17)

std::unordered_multimap is an unordered associative container that supports equivalent keys (an unordered_multimap may contain multiple copies of each key value) and that associates values of another type with the keys. The unordered_multimap class supports forward iterators. Search, insertion, and removal have average constant-time complexity.

Internally, the elements are not sorted in any particular order, but organized into buckets. Which bucket an element is placed into depends entirely on the hash of its key. This allows fast access to individual elements, since once the hash is computed, it refers to the exact bucket the element is placed into.

The iteration order of this container is not required to be stable (so, for example, std::equal cannot be used to compare two std::unordered_multimaps), except that every group of elements whose keys compare equivalent (compare equal with key_eq() as the comparator) forms a contiguous subrange in the iteration order, also accessible with equal_range().

std::unordered_multimap meets the requirements of