std::unordered_multimap
| Defined in header <unordered_map>
|
||
| template< class Key, |
(1) | (since C++11) |
| namespace pmr { template< |
(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 Container, AllocatorAwareContainer, UnorderedAssociativeContainer.
All member functions of std::unordered_multimap are constexpr: it is possible to create and use std::unordered_multimap objects in the evaluation of a constant expression.However, |
(since C++26) |
Contents |
[edit] Template parameters
| This section is incomplete Reason: Add descriptions of the template parameters. |
[edit] Member types
| Type | Definition |
key_type
|
Key
|
mapped_type
|
T
|
value_type
|
std::pair<const Key, T> |
size_type
|
Unsigned integer type (usually std::size_t) |
difference_type
|
Signed integer type (usually std::ptrdiff_t) |
hasher
|
Hash
|
key_equal
|
KeyEqual
|
allocator_type
|
Allocator
|
reference
|
value_type& |
const_reference
|
const value_type& |
pointer
|
std::allocator_traits<Allocator>::pointer |
const_pointer
|
std::allocator_traits<Allocator>::const_pointer |
iterator
|
LegacyForwardIterator and ConstexprIterator(since C++26) to value_type
|
const_iterator
|
LegacyForwardIterator and ConstexprIterator(since C++26) to const value_type |
local_iterator
|
An iterator type whose category, value, difference, pointer and reference types are the same as iterator. This iteratorcan be used to iterate through a single bucket but not across buckets |
const_local_iterator
|
An iterator type whose category, value, difference, pointer and reference types are the same as const_iterator. This iteratorcan be used to iterate through a single bucket but not across buckets |
node_type (since C++17)
|
a specialization of node handle representing a container node |
[edit] Member functions
constructs the unordered_multimap (public member function) | |
destructs the unordered_multimap (public member function) | |
| assigns values to the container (public member function) | |
| returns the associated allocator (public member function) | |
Iterators | |
| returns an iterator to the beginning (public member function) | |
| returns an iterator to the end (public member function) | |
Capacity | |
| checks whether the container is empty (public member function) | |
| returns the number of elements (public member function) | |
| returns the maximum possible number of elements (public member function) | |
Modifiers | |
| clears the contents (public member function) | |
| | |