This class template implements a value‐semantic container type holding a collection of (possibly equivalent) keys (of the template parameter type KEY), each mapped to their associated values (of another template parameter type VALUE).

Synopsis

Declared in <bslstl_unorderedmultimap.h>

template<
    class KEY,
    class VALUE,
    class HASH = bsl::hash<KEY>,
    class EQUAL = bsl::equal_to<KEY>,
    class ALLOCATOR = bsl::allocator<bsl::pair<KEY const, VALUE>>>
class unordered_multimap;

Description

This class: * supports a complete set of value‐semantic operations

  • except for BDEX serialization * is exception‐neutral (agnostic except for the at method) * is alias‐safe * is const thread‐safe For terminology see {`bsldoc_glossary`}.

Type Aliases

Name

Description

allocator_type

This typedef is an alias for allocator_type.

const_iterator

This typedef is an alias for const_iterator.

const_local_iterator

This typedef is an alias for const_local_iterator.

const_pointer

This typedef is an alias to AllocatorTraits::const_pointer.

const_reference

This typedef is an alias for const_reference.

difference_type

This typedef is an alias for difference_type.

hasher

This typedef is an alias to the (template parameter) HASH.

iterator

This typedef is an alias for iterator.

key_equal

This typedef is an alias for key_equal.

key_type

This typedef is an alias for key_type.

local_iterator

This typedef is an alias for local_iterator.

mapped_type

This typedef is an alias for mapped_type.

pointer

This typedef is an alias for pointer.

reference

This typedef is an alias to value_type&.

size_type

This typedef is an alias for size_type.

value_type

This typedef is an alias to bsl::pair<const KEY, VALUE>.

Member Functions

Name

Description

unordered_multimap [constructor]

Constructors

~unordered_multimap [destructor]

Destroy this object.

operator=

Assignment operators

begin

begin overloads

bucket

bucket overloads

bucket_count

Return the number of buckets in the array of buckets maintained by this unordered multimap.

bucket_size

Return the number of elements contained in the bucket at the specified index in the array of buckets maintained by this container. The behavior is undefined unless index < bucket_count().

cbegin

cbegin overloads

cend

cend overloads

clear

Remove all entries from this unordered multimap. Note that this object will be empty after this call, but allocated memory may be retained for future use.

contains

Return true if this unordered map contains an element whose key is equivalent to the specified key.

count

count overloads

emplace

Insert into this unordered multimap a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) args to the corresponding constructor of value_type. Return an iterator referring to the newly created and inserted object in this unordered multimap. This method requires that the (template parameter) types KEY and VALUE both be emplace‐constructible from args (see {Requirements on KEY and VALUE}).

emplace_hint

Insert into this unordered multimap a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) args to the corresponding constructor of value_type (in constant time if the specified hint refers to an element in this container with a key equivalent to the key of the newly created value_type object), and return an iterator referring to the newly created and inserted object. If hint does not refer to an element in this container with a key equivalent to the key of the newly created value_type object, this operation has worst case O[N] and average case constant‐time complexity, where N is the size of this unordered multimap. This method requires that the (template parameter) types KEY and VALUE both be emplace‐constructible from args (see {Requirements on KEY and VALUE}). The behavior is undefined unless hint is an iterator in the range [begin() .. end()] (both endpoints included).

empty

Return true if this unordered multimap contains no elements, and false otherwise.

end

end overloads

equal_range

equal_range overloads

erase

erase overloads

find

find overloads

get_allocator

Return (a copy of) the allocator used for memory allocation by this unordered multimap.

hash_function

Return (a copy of) the hash unary functor used by this unordered multimap to generate a hash value (of type size_type) for a key_type object.

insert

insert overloads

insert_range

Insert into this unordered multimap the value of each value_type object in the specified range. Note that RANGE must meet the requirements of an input range and the values from range must have a type matching or convertible to value_type.

key_eq

Return (a copy of) the key‐equivalence binary functor that returns true if the value of two key_type objects are equivalent, and false otherwise.

load_factor

Return the current ratio between the size of this container and the number of buckets. The load factor is a measure of how full the container is, and a higher load factor typically leads to an increased number of collisions, thus resulting in a loss of performance.

max_bucket_count

Return a theoretical upper bound on the largest number of buckets that this container could possibly manage. Note that there is no guarantee that the unordered multimap can successfully grow to the returned size, or even close to that size without running out of resources.

max_load_factor

max_load_factor overloads

max_size

Return a theoretical upper bound on the largest number of elements that this unordered multimap could possibly hold. Note that there is no guarantee that the unordered multimap can successfully grow to the returned size, or even close to that size without running out of resources.

rehash

Change the size of the array of buckets maintained by this container to the specified numBuckets, and redistribute all the contained elements into the new sequence of buckets, according to their hash values. Note that this operation has no effect if rehashing the elements into numBuckets would cause this unordered multimap to exceed its max_load_factor.

reserve

Increase the number of buckets of this unordered multimap to a quantity such that the ratio between the specified numElements and the new number of buckets does not exceed max_load_factor. Note that this guarantees that, after the reserve, elements can be inserted to grow the container to size() == numElements without rehashing. Also note that memory allocations may still occur when growing the container to size() == numElements. Also note that this operation has no effect if numElements <= size().

size

Return the number of elements in this unordered multimap.

swap

Exchange the contents of this object with those of other.

Deduction Guides

Name

Description

unordered_multimap<KEY, VALUE>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE>

of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameter ALLOCATOR from the other parameter passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, HASH>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. Deduce the template parameter HASH from the other parameters supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE, HASH>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameter HASH from the other parameters passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE, HASH, EQUAL>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. Deduce the template parameters HASH, EQUAL and ALLOCATOR from the other parameters supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE, HASH, EQUAL>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameters HASH and "EQUAL' from the other parameters passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator is convertible to bsl::allocator<bsl::pair<const KEY, VALUE>>.

unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. Deduce the template parameters HASH, EQUAL and ALLOCATOR from the other parameters supplied to the constructor of unordered_multimap. This deduction guide does not participate unless: (1) the supplied HASH is invokable with a KEY, (2) the supplied EQUAL is invokable with two `KEY`s, and (3) the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameters HASH, EQUAL and ALLOCATOR from the other parameters passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. Deduce the template parameters HASH and ALLOCATOR from the other parameters supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied HASH is invokable with a KEY, and the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameters HASH and ALLOCATOR from the other parameters passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied hash is invokable with a KEY, and the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. Deduce the template parameter ALLOCATOR from the other parameters supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the initializer_list supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. Deduce the template parameter ALLOCATOR from the other parameter passed to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

unordered_multimap<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

Deduce the template parameters KEY and VALUE from the value_type of the iterators supplied to the constructor of unordered_multimap. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator.

Friends

Name

Description

bsl::operator==

Same as the related overload above for operator==.

Non-Member Functions

Name

Description

erase_if

Erase all the elements in the specified unordered_multimap m that satisfy the specified predicate predicate. Return the number of elements erased.

operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two unordered_multimap objects have the same value if they have the same number of key‐value pairs, and each key‐value pair that is contained in one of the objects is also contained in the other object. This method requires that the (template parameter) types KEY and VALUE both be equality‐comparable (see {Requirements on KEY and VALUE}).

swap

Exchange the value, hasher, key‐equality functor, and max_load_factor of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no‐throw exception‐safety guarantee if and only if both the (template parameter) types HASH and EQUAL provide no‐throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait.

Created with MrDocs