[#bsl-unordered_multiset-06c] = xref:bsl.adoc[bsl]::unordered_multiset :relfileprefix: ../ :mrdocs: This class template implements a value‐semantic container type holding an unordered multiset of values (of template parameter type `KEY`). == Synopsis Declared in `<bslstl_unorderedmultiset.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class HASH = xref:bsl/hash-06.adoc[bsl::hash<KEY>], class EQUAL = xref:bsl/equal_to-0d.adoc[bsl::equal_to<KEY>], class ALLOCATOR = xref:bsl/allocator-0df.adoc[bsl::allocator<KEY>]> class unordered_multiset; ---- == 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 [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_multiset-06c/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to the (template parameter) `ALLOCATOR`. | xref:bsl/unordered_multiset-06c/const_iterator.adoc[`const_iterator`] | This `typedef` is an alias to `iterator`. | xref:bsl/unordered_multiset-06c/const_local_iterator.adoc[`const_local_iterator`] | This `typedef` is an alias to `local_iterator`. | xref:bsl/unordered_multiset-06c/const_pointer.adoc[`const_pointer`] | This `typedef` is an alias to the allocator const‐pointer type. | xref:bsl/unordered_multiset-06c/const_reference.adoc[`const_reference`] | This `typedef` is an alias for `const_reference`. | xref:bsl/unordered_multiset-06c/difference_type.adoc[`difference_type`] | This `typedef` is an alias to the allocator difference type. | xref:bsl/unordered_multiset-06c/hasher.adoc[`hasher`] | This `typedef` is an alias to the (template parameter) `HASH` type. | xref:bsl/unordered_multiset-06c/iterator.adoc[`iterator`] | This `typedef` is an alias to the hash‐table iterator type. | xref:bsl/unordered_multiset-06c/key_equal.adoc[`key_equal`] | This `typedef` is an alias to the (template parameter) `EQUAL` type. | xref:bsl/unordered_multiset-06c/key_type.adoc[`key_type`] | This `typedef` is an alias to the (template parameter) `KEY` type. | xref:bsl/unordered_multiset-06c/local_iterator.adoc[`local_iterator`] | This `typedef` is an alias to the hash‐table local iterator type. | xref:bsl/unordered_multiset-06c/pointer.adoc[`pointer`] | This `typedef` is an alias to the allocator pointer type. | xref:bsl/unordered_multiset-06c/reference.adoc[`reference`] | This `typedef` is an alias to `value_type&`. | xref:bsl/unordered_multiset-06c/size_type.adoc[`size_type`] | This `typedef` is an alias to the allocator size type. | xref:bsl/unordered_multiset-06c/value_type.adoc[`value_type`] | This `typedef` is an alias to `key_type`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_multiset-06c/2constructor-0ab.adoc[`unordered_multiset`] [.small]#[constructor]# | Constructors | xref:bsl/unordered_multiset-06c/2destructor.adoc[`~unordered_multiset`] [.small]#[destructor]# | Destroy this object. | xref:bsl/unordered_multiset-06c/operator_assign-0c4.adoc[`operator=`] | Assignment operators | xref:bsl/unordered_multiset-06c/begin-0f2.adoc[`begin`] | `begin` overloads | xref:bsl/unordered_multiset-06c/bucket-0a.adoc[`bucket`] | Return the index of the bucket, in the array of buckets of this container, where a value equivalent to the specified `key` would be inserted. | xref:bsl/unordered_multiset-06c/bucket_count.adoc[`bucket_count`] | Return the number of buckets in the array of buckets maintained by this unordered multiset. | xref:bsl/unordered_multiset-06c/bucket_size.adoc[`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()'. | xref:bsl/unordered_multiset-06c/cbegin-02.adoc[`cbegin`] | `cbegin` overloads | xref:bsl/unordered_multiset-06c/cend-0f.adoc[`cend`] | `cend` overloads | xref:bsl/unordered_multiset-06c/clear.adoc[`clear`] | Remove all entries from this unordered multiset. Note that the container is empty after this call, but allocated memory may be retained for future use. | xref:bsl/unordered_multiset-06c/contains-01.adoc[`contains`] | Return `true` if this unordered multiset contains an element whose key is equivalent to the specified `key`. | xref:bsl/unordered_multiset-06c/count-00d.adoc[`count`] | `count` overloads | xref:bsl/unordered_multiset-06c/emplace.adoc[`emplace`] | Insert into this unordered multiset 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 multiset whose value is equivalent to that of an object constructed from `args`. This method requires that the (template parameter) type `KEY` be `emplace‐constructible` into this unordered multiset from `args` (see {Requirements on `KEY`}). | xref:bsl/unordered_multiset-06c/emplace_hint.adoc[`emplace_hint`] | Insert into this unordered multiset 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 equivalent to the newly created `value_type` object). Return an iterator referring to the newly created and inserted object in this unordered multiset whose value is equivalent to that of an object constructed from `args`. If `hint` does not refer to an element in this container equivalent to 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 multiset. This method requires that the (template parameter) type `KEY` be `emplace‐constructible` into this unordered multiset from `args` (see {Requirements on `KEY`}). The behavior is undefined unless `hint` is an iterator in the range `[begin() .. end()]` (both endpoints included). | xref:bsl/unordered_multiset-06c/empty.adoc[`empty`] | Return `true` if this unordered multiset contains no elements, and `false` otherwise. | xref:bsl/unordered_multiset-06c/end-06.adoc[`end`] | `end` overloads | xref:bsl/unordered_multiset-06c/equal_range-00.adoc[`equal_range`] | `equal_range` overloads | xref:bsl/unordered_multiset-06c/erase-03.adoc[`erase`] | `erase` overloads | xref:bsl/unordered_multiset-06c/find-0c.adoc[`find`] | `find` overloads | xref:bsl/unordered_multiset-06c/get_allocator.adoc[`get_allocator`] | Return (a copy of) the allocator used for memory allocation by this unordered multiset. | xref:bsl/unordered_multiset-06c/hash_function.adoc[`hash_function`] | Return (a copy of) the hash unary functor used by this unordered multiset to generate a hash value (of type `size_t`) for a `key_type` object. | xref:bsl/unordered_multiset-06c/insert-09.adoc[`insert`] | `insert` overloads | xref:bsl/unordered_multiset-06c/insert_range.adoc[`insert_range`] | Insert into this unordered multiset the value of each `value_type` object in the specified `range`. The (template parameter) type `RANGE` must meet the requirements the C++20 standard [ranges] providing access to values of a type convertible to `value_type`, and `value_type` must be `emplace‐constructible` from `*i` into this unordered multiset, where `i` is a dereferenceable iterator obtained from `range` (see {Requirements on `KEY`}). The behavior is undefined if `range` overlaps this unordered multiset. | xref:bsl/unordered_multiset-06c/key_eq.adoc[`key_eq`] | Return (a copy of) the key‐equality binary functor that returns `true` if the value of two `key_type` objects are equivalent, and `false` otherwise. | xref:bsl/unordered_multiset-06c/load_factor.adoc[`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 leads to an increased number of collisions, thus resulting in a loss performance. | xref:bsl/unordered_multiset-06c/max_bucket_count.adoc[`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 multiset can successfully grow to the returned size, or even close to that size without running out of resources. | xref:bsl/unordered_multiset-06c/max_load_factor-04.adoc[`max_load_factor`] | `max_load_factor` overloads | xref:bsl/unordered_multiset-06c/max_size.adoc[`max_size`] | Return a theoretical upper bound on the largest number of elements that this unordered multiset could possibly hold. Note that there is no guarantee that the unordered multiset can successfully grow to the returned size, or even close to that size without running out of resources. | xref:bsl/unordered_multiset-06c/rehash.adoc[`rehash`] | Change the size of the array of buckets maintained by this container to at least 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 multiset to exceed its `max_load_factor`. | xref:bsl/unordered_multiset-06c/reserve.adoc[`reserve`] | Increase the number of buckets of this unordered multiset to a quantity such that the ratio between the specified `numElements` and this quantity 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()`. | xref:bsl/unordered_multiset-06c/size.adoc[`size`] | Return the number of elements in this unordered multiset. | xref:bsl/unordered_multiset-06c/swap.adoc[`swap`] | Exchange the value, hasher, key‐equality functor, and `max_load_factor` of this object with those of the specified `other` object; also exchange the allocator of this object with that of `other` if the (template parameter) type `ALLOCATOR` has the `propagate_on_container_swap` trait, and do not modify either allocator otherwise. This method 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 this object was created with the same allocator as `other` or `ALLOCATOR` has the `propagate_on_container_swap` trait. | xref:bsl/unordered_multiset-06c/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<unordered_multiset, IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value>`] | Nested trait declaration for `bslmf::IsBitwiseMoveable`. |=== == Deduction Guides [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_multiset-05.adoc[`unordered_multiset<KEY>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-09e.adoc[`unordered_multiset<KEY>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-07f.adoc[`unordered_multiset<KEY>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-07a.adoc[`unordered_multiset<KEY>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-063.adoc[`unordered_multiset<KEY, HASH>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. Deduce the template parameter `HASH` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-0d3.adoc[`unordered_multiset<KEY, HASH>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. Deduce the template parameter `HASH` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-0a9.adoc[`unordered_multiset<KEY, HASH, EQUAL>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH` and `EQUAL` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-091.adoc[`unordered_multiset<KEY, HASH, EQUAL>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH` and `EQUAL` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied allocator is convertible to `bsl::allocator<KEY>`. | xref:bsl/unordered_multiset-009.adoc[`unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH`, EQUAL and `ALLOCATOR` from the other parameters passed to the constructor. This deduction guide does not participate unless: (1) the supplied `HASH` is invocable with a `KEY`, (2) the supplied `EQUAL` is invocable with two `KEY`s, and (3) the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-0ab.adoc[`unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH`, `EQUAL` and `ALLOCATOR` from the other parameters passed to the constructor. This deduction guide does not participate unless: (1) the supplied `HASH` is invocable with a `KEY`, (2) the supplied `EQUAL` is invocable with two `KEY`s, and (3) the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-00df.adoc[`unordered_multiset<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH` and `ALLOCATOR` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied `HASH` is invocable with a `KEY`, and the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-0db.adoc[`unordered_multiset<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. Deduce the template parameters `HASH` and `ALLOCATOR` from the other parameters passed to the constructor. This deduction guide does not participate unless the supplied `HASH` is invocable with a `KEY`, and the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-0d0.adoc[`unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-00d8.adoc[`unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the initializer_list supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-0e.adoc[`unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator. | xref:bsl/unordered_multiset-02.adoc[`unordered_multiset<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | Deduce the template parameter `KEY` from the `value_type` of the iterators supplied to the constructor of `unordered_multiset`. This deduction guide does not participate unless the supplied allocator meets the requirements of a standard allocator. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:bsl/operator_eq-0a2.adoc[bsl::operator==]` | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/erase_if-074.adoc[`erase_if`] | Erase all the elements in the specified unordered_multiset `ms` that satisfy the specified predicate `predicate`. Return the number of elements erased. | xref:bsl/operator_eq-094.adoc[`operator==`] | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. Two `unordered_multiset` objects have the same value if they have the same number of value elements, and for each value‐element that is contained in `lhs` there is a value‐element contained in `rhs` having the same value, and vice‐versa. Note that this method requires that the (template parameter) type `KEY` be `equality‐comparable` (see {Requirements on `KEY`}). | xref:bsl/swap-03d7.adoc[`swap`] | Exchange the values of the specified `a` and `b` objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#