[#bsl-unordered_map-02b] = xref:bsl.adoc[bsl]::unordered_map :relfileprefix: ../ :mrdocs: Unordered associative container mapping unique keys to values. == Synopsis Declared in `<bslstl_unorderedmap.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class VALUE, 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<bsl::pair<KEY const, VALUE>>]> class unordered_map; ---- == Description This class template implements a value‐semantic container type holding an unordered set of `KEY‐VALUE` pairs having unique keys that provide a mapping from keys (of template parameter type `KEY`) to their associated mapped values (of template parameter type `VALUE`). This class: * supports a complete set of _value‐semantic_ operations * 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_map-02b/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to the (template parameter) `ALLOCATOR`. | xref:bsl/unordered_map-02b/const_iterator.adoc[`const_iterator`] | This `typedef` is an alias to `HashTableIterator<const value_type>`. | xref:bsl/unordered_map-02b/const_local_iterator.adoc[`const_local_iterator`] | This `typedef` is an alias to `HashTableBucketIterator<const value_type>`. | xref:bsl/unordered_map-02b/const_pointer.adoc[`const_pointer`] | This `typedef` is an alias to `AllocatorTraits::const_pointer`. | xref:bsl/unordered_map-02b/const_reference.adoc[`const_reference`] | This `typedef` is an alias to `const value_type&`. | xref:bsl/unordered_map-02b/difference_type.adoc[`difference_type`] | This `typedef` is an alias to `AllocatorTraits::difference_type`. | xref:bsl/unordered_map-02b/hasher.adoc[`hasher`] | This `typedef` is an alias to the (template parameter) `HASH`. | xref:bsl/unordered_map-02b/iterator.adoc[`iterator`] | This `typedef` is an alias to `HashTableIterator<value_type>`. | xref:bsl/unordered_map-02b/key_equal.adoc[`key_equal`] | This `typedef` is an alias to the (template parameter) `EQUAL`. | xref:bsl/unordered_map-02b/key_type.adoc[`key_type`] | This `typedef` is an alias to the (template parameter) `KEY`. | xref:bsl/unordered_map-02b/local_iterator.adoc[`local_iterator`] | This `typedef` is an alias to `HashTableBucketIterator<value_type>`. | xref:bsl/unordered_map-02b/mapped_type.adoc[`mapped_type`] | This `typedef` is an alias to the (template parameter) `VALUE`. | xref:bsl/unordered_map-02b/pointer.adoc[`pointer`] | This `typedef` is an alias to `AllocatorTraits::pointer`. | xref:bsl/unordered_map-02b/reference.adoc[`reference`] | This `typedef` is an alias to `value_type&`. | xref:bsl/unordered_map-02b/size_type.adoc[`size_type`] | This `typedef` is an alias to `AllocatorTraits::size_type`. | xref:bsl/unordered_map-02b/value_type.adoc[`value_type`] | This `typedef` is an alias to `bsl::pair<const KEY, VALUE>`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_map-02b/2constructor-0f0.adoc[`unordered_map`] [.small]#[constructor]# | Constructors | xref:bsl/unordered_map-02b/2destructor.adoc[`~unordered_map`] [.small]#[destructor]# | Destroy this object and each of its elements. | xref:bsl/unordered_map-02b/operator_assign-08.adoc[`operator=`] | Assignment operators | xref:bsl/unordered_map-02b/at-0f.adoc[`at`] | `at` overloads | xref:bsl/unordered_map-02b/begin-0a.adoc[`begin`] | `begin` overloads | xref:bsl/unordered_map-02b/bucket-02.adoc[`bucket`] | `bucket` overloads | xref:bsl/unordered_map-02b/bucket_count.adoc[`bucket_count`] | Return the number of buckets in the array of buckets maintained by this unordered map. | xref:bsl/unordered_map-02b/bucket_size.adoc[`bucket_size`] | Return the number of elements in the bucket at `index`. | xref:bsl/unordered_map-02b/cbegin-03.adoc[`cbegin`] | `cbegin` overloads | xref:bsl/unordered_map-02b/cend-09.adoc[`cend`] | `cend` overloads | xref:bsl/unordered_map-02b/clear.adoc[`clear`] | Remove all entries from this unordered map. | xref:bsl/unordered_map-02b/contains-0a.adoc[`contains`] | `contains` overloads | xref:bsl/unordered_map-02b/count-08.adoc[`count`] | `count` overloads | xref:bsl/unordered_map-02b/emplace.adoc[`emplace`] | Emplace a newly constructed element if its key is not already present. | xref:bsl/unordered_map-02b/emplace_hint.adoc[`emplace_hint`] | Emplace a newly constructed element at `hint` if its key is missing. | xref:bsl/unordered_map-02b/empty.adoc[`empty`] | Return `true` if this unordered map contains no elements, and `false` otherwise. | xref:bsl/unordered_map-02b/end-07c.adoc[`end`] | `end` overloads | xref:bsl/unordered_map-02b/equal_range-05.adoc[`equal_range`] | `equal_range` overloads | xref:bsl/unordered_map-02b/erase-000.adoc[`erase`] | `erase` overloads | xref:bsl/unordered_map-02b/find-0a.adoc[`find`] | `find` overloads | xref:bsl/unordered_map-02b/get_allocator.adoc[`get_allocator`] | Return (a copy of) the allocator used for memory allocation by this unordered map. | xref:bsl/unordered_map-02b/hash_function.adoc[`hash_function`] | Return (a copy of) the unary hash functor used by this unordered map to generate a hash value (of type `size_type`) for a `key_type` object. | xref:bsl/unordered_map-02b/insert-03.adoc[`insert`] | `insert` overloads | xref:bsl/unordered_map-02b/insert_or_assign-068.adoc[`insert_or_assign`] | `insert_or_assign` overloads | xref:bsl/unordered_map-02b/insert_range.adoc[`insert_range`] | Insert each element of `range` whose key is not already present. | xref:bsl/unordered_map-02b/key_eq.adoc[`key_eq`] | Return (a copy of) binary the key‐equality functor used by this unordered map that returns `true` if two `key_type` objects are equivalent, and `false` otherwise. | xref:bsl/unordered_map-02b/load_factor.adoc[`load_factor`] | Return the current load factor of this unordered map. | xref:bsl/unordered_map-02b/max_bucket_count.adoc[`max_bucket_count`] | Return a theoretical upper bound on the number of buckets. | xref:bsl/unordered_map-02b/max_load_factor-0a.adoc[`max_load_factor`] | `max_load_factor` overloads | xref:bsl/unordered_map-02b/max_size.adoc[`max_size`] | Return a theoretical upper bound on the size of this unordered map. | xref:bsl/unordered_map-02b/operator_subs-01.adoc[`operator[]`] | Subscript operators | xref:bsl/unordered_map-02b/rehash.adoc[`rehash`] | Rehash this unordered map to at least `numBuckets` buckets. | xref:bsl/unordered_map-02b/reserve.adoc[`reserve`] | Reserve capacity for at least `numElements` without rehashing. | xref:bsl/unordered_map-02b/size.adoc[`size`] | Return the number of elements in this unordered map. | xref:bsl/unordered_map-02b/swap.adoc[`swap`] | Exchange the contents of this object with those of `other`. | xref:bsl/unordered_map-02b/try_emplace-050.adoc[`try_emplace`] | `try_emplace` overloads |=== == Deduction Guides [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_map-049.adoc[`unordered_map<KEY, VALUE>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-0c.adoc[`unordered_map<KEY, VALUE>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-0d.adoc[`unordered_map<KEY, VALUE>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-099.adoc[`unordered_map<KEY, VALUE>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-08b.adoc[`unordered_map<KEY, VALUE, HASH>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-045.adoc[`unordered_map<KEY, VALUE, HASH>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-0b4.adoc[`unordered_map<KEY, VALUE, HASH, EQUAL>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-01f.adoc[`unordered_map<KEY, VALUE, HASH, EQUAL>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-014.adoc[`unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-0ea.adoc[`unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-05d.adoc[`unordered_map<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-0e6.adoc[`unordered_map<KEY, VALUE, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-021.adoc[`unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-09a.adoc[`unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from initializer_list `value_type`. | xref:bsl/unordered_map-051.adoc[`unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. | xref:bsl/unordered_map-080.adoc[`unordered_map<KEY, VALUE, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` and `VALUE` from iterator `value_type`. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:bsl/operator_eq-0cb.adoc[bsl::operator==]` | Return `true` if `lhs` and `rhs` have the same value, and `false` otherwise. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/erase_if-0a4.adoc[`erase_if`] | Erase every element of `m` that satisfies `predicate`. | xref:bsl/operator_eq-024.adoc[`operator==`] | Return `true` if `lhs` and `rhs` have the same value, and `false` otherwise. | xref:bsl/swap-04c.adoc[`swap`] | Exchange the contents of `a` with those of `b`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#