[#bsl-multimap-0ae]
= xref:bsl.adoc[bsl]::multimap
:relfileprefix: ../
:mrdocs:

Ordered associative container mapping keys to values, allowing duplicates&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;multimap&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class COMPARATOR = std::less&lt;KEY&gt;,
    class ALLOCATOR = xref:bsl/allocator-0df.adoc[allocator&lt;pair&lt;KEY const, VALUE&gt;&gt;]&gt;
class multimap;
----

== Description

This class template implements a value&hyphen;semantic container type holding an ordered sequence of key&hyphen;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`)&period;

This class&colon; &ast; supports a complete set of _value&hyphen;semantic_ operations

* except for BDEX serialization &ast; is _exception&hyphen;neutral_ &ast; is _alias&hyphen;safe_ &ast; is `const` _thread&hyphen;safe_ For terminology see &lcub;`bsldoc&lowbar;glossary`&rcub;&period;

== Types

[cols="1,4"]
|===
| Name| Description
| xref:bsl/multimap-0ae/value_compare.adoc[`value&lowbar;compare`] 
| Adaptor that compares `value&lowbar;type` objects by their keys&period;
|===


== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/multimap-0ae/allocator_type.adoc[`allocator&lowbar;type`] 
| Allocator type for this container&period;
| xref:bsl/multimap-0ae/const_iterator.adoc[`const&lowbar;iterator`] 
| Constant bidirectional iterator over `multimap` elements&period;
| xref:bsl/multimap-0ae/const_pointer.adoc[`const&lowbar;pointer`] 
| Constant pointer type for elements in this container&period;
| xref:bsl/multimap-0ae/const_reference.adoc[`const&lowbar;reference`] 
| Constant reference type for elements&period;
| xref:bsl/multimap-0ae/const_reverse_iterator.adoc[`const&lowbar;reverse&lowbar;iterator`] 
| Const reverse iterator type for traversing the multimap in reverse order&period;
| xref:bsl/multimap-0ae/difference_type.adoc[`difference&lowbar;type`] 
| Signed integer type measuring iterator distance&period;
| xref:bsl/multimap-0ae/iterator.adoc[`iterator`] 
| Bidirectional iterator over `multimap` elements&period;
| xref:bsl/multimap-0ae/key_compare.adoc[`key&lowbar;compare`] 
| Comparator type for ordering keys&period;
| xref:bsl/multimap-0ae/key_type.adoc[`key&lowbar;type`] 
| Key type for this multimap&period;
| xref:bsl/multimap-0ae/mapped_type.adoc[`mapped&lowbar;type`] 
| Mapped value type for this multimap&period;
| xref:bsl/multimap-0ae/pointer.adoc[`pointer`] 
| Pointer type for elements in this container&period;
| xref:bsl/multimap-0ae/reference.adoc[`reference`] 
| Modifiable reference type for elements&period;
| xref:bsl/multimap-0ae/reverse_iterator.adoc[`reverse&lowbar;iterator`] 
| Reverse iterator type for traversing the multimap in reverse order&period;
| xref:bsl/multimap-0ae/size_type.adoc[`size&lowbar;type`] 
| Unsigned integer type measuring multimap size&period;
| xref:bsl/multimap-0ae/value_type.adoc[`value&lowbar;type`] 
| Element type stored in this multimap&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/multimap-0ae/2constructor-005.adoc[`multimap`]         [.small]#[constructor]#
| Constructors
| xref:bsl/multimap-0ae/2destructor.adoc[`&#126;multimap`] [.small]#[destructor]#
| Destroy this object&period;
| xref:bsl/multimap-0ae/operator_assign-07.adoc[`operator&equals;`] 
| 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&period;
| xref:bsl/multimap-0ae/cend.adoc[`cend`] 
| Return an iterator providing non&hyphen;modifiable access to the past&hyphen;the&hyphen;end element in the ordered sequence of `value&lowbar;type` objects maintained by this multimap&period;
| xref:bsl/multimap-0ae/clear.adoc[`clear`] 
| Remove all entries from this multimap&period; Note that the multimap is empty after this call, but allocated memory may be retained for future use&period;
| xref:bsl/multimap-0ae/contains-05.adoc[`contains`] 
| Return whether this multimap contains an element equivalent to `key`&period;
| 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&period;
| xref:bsl/multimap-0ae/crend.adoc[`crend`] 
| Return a const reverse iterator to prior&hyphen;to&hyphen;beginning&period;
| xref:bsl/multimap-0ae/emplace.adoc[`emplace`] 
| Emplace a newly constructed element into this multimap&period;
| xref:bsl/multimap-0ae/emplace_hint.adoc[`emplace&lowbar;hint`] 
| Emplace a newly constructed element near `hint`&period;
| xref:bsl/multimap-0ae/empty.adoc[`empty`] 
| Return `true` if this multimap contains no elements, and `false` otherwise&period;
| xref:bsl/multimap-0ae/end-07.adoc[`end`] 
| `end` overloads
| xref:bsl/multimap-0ae/equal_range-00.adoc[`equal&lowbar;range`] 
| Return the half&hyphen;open range of elements equivalent to `key`&period;
| 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&lowbar;allocator`] 
| Return (a copy of) the allocator used for memory allocation by this multimap&period;
| xref:bsl/multimap-0ae/insert-09.adoc[`insert`] 
| `insert` overloads
| xref:bsl/multimap-0ae/insert_range.adoc[`insert&lowbar;range`] 
| Insert each element from `range` into this multimap&period;
| xref:bsl/multimap-0ae/key_comp.adoc[`key&lowbar;comp`] 
| Return the key&hyphen;comparison functor used by this multimap&period;
| xref:bsl/multimap-0ae/lower_bound-079.adoc[`lower&lowbar;bound`] 
| `lower&lowbar;bound` overloads
| xref:bsl/multimap-0ae/max_size.adoc[`max&lowbar;size`] 
| Return a theoretical upper bound on the size of this multimap&period;
| 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&period;
| xref:bsl/multimap-0ae/swap.adoc[`swap`] 
| Exchange the value and comparator of this object with those of `other`&period;
| xref:bsl/multimap-0ae/upper_bound-00.adoc[`upper&lowbar;bound`] 
| `upper&lowbar;bound` overloads
| xref:bsl/multimap-0ae/value_comp.adoc[`value&lowbar;comp`] 
| Return a functor that compares two `value&lowbar;type` objects by key&period;
|===


== Deduction Guides

[cols="1,4"]
|===
| Name| Description
| xref:bsl/multimap-07.adoc[`multimap&lt;KEY, VALUE&gt;`] 
| Deduce `KEY` and `VALUE` from an initializer&hyphen;list constructor argument&period;
| xref:bsl/multimap-0d.adoc[`multimap&lt;KEY, VALUE&gt;`] 
| Deduce `KEY` and `VALUE` from iterator&hyphen;pair construction with a pointer allocator&period;
| xref:bsl/multimap-0e.adoc[`multimap&lt;KEY, VALUE, COMPARATOR&gt;`] 
| Deduce `KEY`, `VALUE`, and `COMPARATOR` from initializer&hyphen;list construction&period;
| xref:bsl/multimap-01.adoc[`multimap&lt;KEY, VALUE, COMPARATOR&gt;`] 
| Deduce `KEY`, `VALUE`, and `COMPARATOR` from iterator&hyphen;pair construction&period;
| xref:bsl/multimap-0a3.adoc[`multimap&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;`] 
| Deduce `KEY`, `VALUE`, `COMPARATOR`, and `ALLOCATOR` from initializer&hyphen;list construction&period;
| xref:bsl/multimap-0f.adoc[`multimap&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;`] 
| Deduce `KEY`, `VALUE`, `COMPARATOR`, and `ALLOCATOR` from iterator&hyphen;pair construction&period;
| xref:bsl/multimap-09.adoc[`multimap&lt;KEY, VALUE, std::less&lt;KEY&gt;, ALLOCATOR&gt;`] 
| Deduce `KEY`, `VALUE`, and `ALLOCATOR` from initializer&hyphen;list construction&period;
| xref:bsl/multimap-00.adoc[`multimap&lt;KEY, VALUE, std::less&lt;KEY&gt;, ALLOCATOR&gt;`] 
| Deduce `KEY`, `VALUE`, and `ALLOCATOR` from iterator&hyphen;pair construction&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/erase_if-0f.adoc[`erase&lowbar;if`]
| Erase every element of `m` that satisfies `predicate`&period;
| xref:bsl/operator_3way-081.adoc[`operator&lt;&equals;&gt;`]
| Perform a lexicographic three&hyphen;way comparison of `lhs` and `rhs`&period;
| xref:bsl/operator_eq-03.adoc[`operator&equals;&equals;`]
| Return `true` if `lhs` and `rhs` have the same value&period;
| xref:bsl/swap-073.adoc[`swap`]
| Exchange the value and comparator of `a` with those of `b`&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
