bsl::multimap

Ordered associative container mapping keys to values, allowing duplicates.

Synopsis

Declared in <bslstl_multimap.h>

template<
    class KEY,
    class VALUE,
    class COMPARATOR = std::less<KEY>,
    class ALLOCATOR = allocator<pair<KEY const, VALUE>>>
class multimap;

Description

This class template implements a value-semantic container type holding an ordered sequence of key-value pairs having possibly duplicate keys that provide a mapping from keys (of the template parameter type, KEY) to their associated values (of another template parameter type, VALUE).

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

  • except for BDEX serialization * is exception-neutral * is alias-safe * is const thread-safe For terminology see {bsldoc_glossary}.

Types

NameDescription
value_compare Adaptor that compares value_type objects by their keys.

Type Aliases

NameDescription
allocator_type Allocator type for this container.
const_iterator Constant bidirectional iterator over multimap elements.
const_pointer Constant pointer type for elements in this container.
const_reference Constant reference type for elements.
const_reverse_iterator Const reverse iterator type for traversing the multimap in reverse order.
difference_type Signed integer type measuring iterator distance.
iterator Bidirectional iterator over multimap elements.
key_compare Comparator type for ordering keys.
key_type Key type for this multimap.
mapped_type Mapped value type for this multimap.
pointer Pointer type for elements in this container.
reference Modifiable reference type for elements.
reverse_iterator Reverse iterator type for traversing the multimap in reverse order.
size_type Unsigned integer type measuring multimap size.
value_type Element type stored in this multimap.

Member Functions

NameDescription
multimap [constructor]Constructors
~multimap [destructor]Destroy this object.
operator= Assignment operators
begin begin overloads
cbegin Return a const iterator to the beginning of this multimap.
cend Return an iterator providing non-modifiable access to the past-the-end element in the ordered sequence of value_type objects maintained by this multimap.
clear Remove all entries from this multimap. Note that the multimap is empty after this call, but allocated memory may be retained for future use.
contains Return whether this multimap contains an element equivalent to key.
count count overloads
crbegin Return a const reverse iterator to the last element, or crend if empty.
crend Return a const reverse iterator to prior-to-beginning.
emplace Emplace a newly constructed element into this multimap.
emplace_hint Emplace a newly constructed element near hint.
empty Return true if this multimap contains no elements, and false otherwise.
end end overloads
equal_range Return the half-open range of elements equivalent to key.
erase erase overloads
find find overloads
get_allocator Return (a copy of) the allocator used for memory allocation by this multimap.
insert insert overloads
insert_range Insert each element from range into this multimap.
key_comp Return the key-comparison functor used by this multimap.
lower_bound lower_bound overloads
max_size Return a theoretical upper bound on the size of this multimap.
rbegin rbegin overloads
rend rend overloads
size Return the number of elements in this multimap.
swap Exchange the value and comparator of this object with those of other.
upper_bound upper_bound overloads
value_comp Return a functor that compares two value_type objects by key.

Deduction Guides

NameDescription
multimap<KEY, VALUE> Deduce KEY and VALUE from an initializer-list constructor argument.
multimap<KEY, VALUE> Deduce KEY and VALUE from iterator-pair construction with a pointer allocator.
multimap<KEY, VALUE, COMPARATOR> Deduce KEY, VALUE, and COMPARATOR from initializer-list construction.
multimap<KEY, VALUE, COMPARATOR> Deduce KEY, VALUE, and COMPARATOR from iterator-pair construction.
multimap<KEY, VALUE, COMPARATOR, ALLOCATOR> Deduce KEY, VALUE, COMPARATOR, and ALLOCATOR from initializer-list construction.
multimap<KEY, VALUE, COMPARATOR, ALLOCATOR> Deduce KEY, VALUE, COMPARATOR, and ALLOCATOR from iterator-pair construction.
multimap<KEY, VALUE, std::less<KEY>, ALLOCATOR> Deduce KEY, VALUE, and ALLOCATOR from initializer-list construction.
multimap<KEY, VALUE, std::less<KEY>, ALLOCATOR> Deduce KEY, VALUE, and ALLOCATOR from iterator-pair construction.

Non-Member Functions

NameDescription
erase_ifErase every element of m that satisfies predicate.
operator<=>Perform a lexicographic three-way comparison of lhs and rhs.
operator==Return true if lhs and rhs have the same value.
swapExchange the value and comparator of a with those of b.