[#bsl-multimap-0ae] = xref:bsl.adoc[bsl]::multimap :relfileprefix: ../ :mrdocs: Ordered associative container mapping keys to values, allowing duplicates. == Synopsis Declared in `<bslstl_multimap.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE, class COMPARATOR = std::less<KEY>, class ALLOCATOR = xref:bsl/allocator-0df.adoc[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 [cols="1,4"] |=== | Name| Description | xref:bsl/multimap-0ae/value_compare.adoc[`value_compare`] | Adaptor that compares `value_type` objects by their keys. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/multimap-0ae/allocator_type.adoc[`allocator_type`] | Allocator type for this container. | xref:bsl/multimap-0ae/const_iterator.adoc[`const_iterator`] | Constant bidirectional iterator over `multimap` elements. | xref:bsl/multimap-0ae/const_pointer.adoc[`const_pointer`] | Constant pointer type for elements in this container. | xref:bsl/multimap-0ae/const_reference.adoc[`const_reference`] | Constant reference type for elements. | xref:bsl/multimap-0ae/const_reverse_iterator.adoc[`const_reverse_iterator`] | Const reverse iterator type for traversing the multimap in reverse order. | xref:bsl/multimap-0ae/difference_type.adoc[`difference_type`] | Signed integer type measuring iterator distance. | xref:bsl/multimap-0ae/iterator.adoc[`iterator`] | Bidirectional iterator over `multimap` elements. | xref:bsl/multimap-0ae/key_compare.adoc[`key_compare`] | Comparator type for ordering keys. | xref:bsl/multimap-0ae/key_type.adoc[`key_type`] | Key type for this multimap. | xref:bsl/multimap-0ae/mapped_type.adoc[`mapped_type`] | Mapped value type for this multimap. | xref:bsl/multimap-0ae/pointer.adoc[`pointer`] | Pointer type for elements in this container. | xref:bsl/multimap-0ae/reference.adoc[`reference`] | Modifiable reference type for elements. | xref:bsl/multimap-0ae/reverse_iterator.adoc[`reverse_iterator`] | Reverse iterator type for traversing the multimap in reverse order. | xref:bsl/multimap-0ae/size_type.adoc[`size_type`] | Unsigned integer type measuring multimap size. | xref:bsl/multimap-0ae/value_type.adoc[`value_type`] | Element type stored in this multimap. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/multimap-0ae/2constructor-005.adoc[`multimap`] [.small]#[constructor]# | Constructors | xref:bsl/multimap-0ae/2destructor.adoc[`~multimap`] [.small]#[destructor]# | Destroy this object. | xref:bsl/multimap-0ae/operator_assign-07.adoc[`operator=`] | Assignment operators | xref:bsl/multimap-0ae/begin-04a.adoc[`begin`] | `begin` overloads | xref:bsl/multimap-0ae/cbegin.adoc[`cbegin`] | Return a const iterator to the beginning of this multimap. | xref:bsl/multimap-0ae/cend.adoc[`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. | xref:bsl/multimap-0ae/clear.adoc[`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. | xref:bsl/multimap-0ae/contains-05.adoc[`contains`] | Return whether this multimap contains an element equivalent to `key`. | xref:bsl/multimap-0ae/count-07.adoc[`count`] | `count` overloads | xref:bsl/multimap-0ae/crbegin.adoc[`crbegin`] | Return a const reverse iterator to the last element, or `crend` if empty. | xref:bsl/multimap-0ae/crend.adoc[`crend`] | Return a const reverse iterator to prior‐to‐beginning. | xref:bsl/multimap-0ae/emplace.adoc[`emplace`] | Emplace a newly constructed element into this multimap. | xref:bsl/multimap-0ae/emplace_hint.adoc[`emplace_hint`] | Emplace a newly constructed element near `hint`. | xref:bsl/multimap-0ae/empty.adoc[`empty`] | Return `true` if this multimap contains no elements, and `false` otherwise. | xref:bsl/multimap-0ae/end-07.adoc[`end`] | `end` overloads | xref:bsl/multimap-0ae/equal_range-00.adoc[`equal_range`] | Return the half‐open range of elements equivalent to `key`. | xref:bsl/multimap-0ae/erase-039.adoc[`erase`] | `erase` overloads | xref:bsl/multimap-0ae/find-0c.adoc[`find`] | `find` overloads | xref:bsl/multimap-0ae/get_allocator.adoc[`get_allocator`] | Return (a copy of) the allocator used for memory allocation by this multimap. | xref:bsl/multimap-0ae/insert-09.adoc[`insert`] | `insert` overloads | xref:bsl/multimap-0ae/insert_range.adoc[`insert_range`] | Insert each element from `range` into this multimap. | xref:bsl/multimap-0ae/key_comp.adoc[`key_comp`] | Return the key‐comparison functor used by this multimap. | xref:bsl/multimap-0ae/lower_bound-079.adoc[`lower_bound`] | `lower_bound` overloads | xref:bsl/multimap-0ae/max_size.adoc[`max_size`] | Return a theoretical upper bound on the size of this multimap. | xref:bsl/multimap-0ae/rbegin-02.adoc[`rbegin`] | `rbegin` overloads | xref:bsl/multimap-0ae/rend-06.adoc[`rend`] | `rend` overloads | xref:bsl/multimap-0ae/size.adoc[`size`] | Return the number of elements in this multimap. | xref:bsl/multimap-0ae/swap.adoc[`swap`] | Exchange the value and comparator of this object with those of `other`. | xref:bsl/multimap-0ae/upper_bound-00.adoc[`upper_bound`] | `upper_bound` overloads | xref:bsl/multimap-0ae/value_comp.adoc[`value_comp`] | Return a functor that compares two `value_type` objects by key. |=== == Deduction Guides [cols="1,4"] |=== | Name| Description | xref:bsl/multimap-07.adoc[`multimap<KEY, VALUE>`] | Deduce `KEY` and `VALUE` from an initializer‐list constructor argument. | xref:bsl/multimap-0d.adoc[`multimap<KEY, VALUE>`] | Deduce `KEY` and `VALUE` from iterator‐pair construction with a pointer allocator. | xref:bsl/multimap-0e.adoc[`multimap<KEY, VALUE, COMPARATOR>`] | Deduce `KEY`, `VALUE`, and `COMPARATOR` from initializer‐list construction. | xref:bsl/multimap-01.adoc[`multimap<KEY, VALUE, COMPARATOR>`] | Deduce `KEY`, `VALUE`, and `COMPARATOR` from iterator‐pair construction. | xref:bsl/multimap-0a3.adoc[`multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>`] | Deduce `KEY`, `VALUE`, `COMPARATOR`, and `ALLOCATOR` from initializer‐list construction. | xref:bsl/multimap-0f.adoc[`multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>`] | Deduce `KEY`, `VALUE`, `COMPARATOR`, and `ALLOCATOR` from iterator‐pair construction. | xref:bsl/multimap-09.adoc[`multimap<KEY, VALUE, std::less<KEY>, ALLOCATOR>`] | Deduce `KEY`, `VALUE`, and `ALLOCATOR` from initializer‐list construction. | xref:bsl/multimap-00.adoc[`multimap<KEY, VALUE, std::less<KEY>, ALLOCATOR>`] | Deduce `KEY`, `VALUE`, and `ALLOCATOR` from iterator‐pair construction. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/erase_if-0f.adoc[`erase_if`] | Erase every element of `m` that satisfies `predicate`. | xref:bsl/operator_3way-081.adoc[`operator<=>`] | Perform a lexicographic three‐way comparison of `lhs` and `rhs`. | xref:bsl/operator_eq-03.adoc[`operator==`] | Return `true` if `lhs` and `rhs` have the same value. | xref:bsl/swap-073.adoc[`swap`] | Exchange the value and comparator of `a` with those of `b`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#