[#absl-linked_hash_map] = xref:absl.adoc[absl]::linked_hash_map :relfileprefix: ../ :mrdocs: An insertion‐ordered map. == Synopsis Declared in `<absl/container/linked_hash_map.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename Key, typename Value, typename KeyHash = absl::flat_hash_set<Key>::hasher, typename KeyEq = absl::flat_hash_set<Key, KeyHash>::key_equal, typename Alloc = std::allocator<std::pair<Key const, Value>>> class linked_hash_map; ---- == Description Provides O(1) amortized insertions and lookups, as well as iteration over the map in the insertion order. This class is thread‐compatible, but not exception‐safe. It supports heterogeneous lookups. == Type Aliases [cols="1,4"] |=== | Name| Description | xref:absl/linked_hash_map/allocator_type.adoc[`allocator_type`] | The allocator type. | xref:absl/linked_hash_map/const_iterator.adoc[`const_iterator`] | The const iterator type, iterating in insertion order. | xref:absl/linked_hash_map/const_pointer.adoc[`const_pointer`] | A const pointer to an element. | xref:absl/linked_hash_map/const_reference.adoc[`const_reference`] | A const reference to an element. | xref:absl/linked_hash_map/const_reverse_iterator.adoc[`const_reverse_iterator`] | The const reverse iterator type. | xref:absl/linked_hash_map/difference_type.adoc[`difference_type`] | The signed integer type for iterator differences. | xref:absl/linked_hash_map/hasher.adoc[`hasher`] | The hash function type for keys. | xref:absl/linked_hash_map/insert_return_type.adoc[`insert_return_type`] | The return type of node‐handle insertions. | xref:absl/linked_hash_map/iterator.adoc[`iterator`] | The iterator type, iterating in insertion order. | xref:absl/linked_hash_map/key_equal.adoc[`key_equal`] | The equality comparison type for keys. | xref:absl/linked_hash_map/key_type.adoc[`key_type`] | The key type. | xref:absl/linked_hash_map/mapped_type.adoc[`mapped_type`] | The mapped value type. | xref:absl/linked_hash_map/node_type.adoc[`node_type`] | The node handle type used to extract and reinsert elements. | xref:absl/linked_hash_map/pointer.adoc[`pointer`] | A pointer to an element. | xref:absl/linked_hash_map/reference.adoc[`reference`] | A reference to an element. | xref:absl/linked_hash_map/reverse_iterator.adoc[`reverse_iterator`] | The reverse iterator type. | xref:absl/linked_hash_map/size_type.adoc[`size_type`] | The unsigned integer type for sizes. | xref:absl/linked_hash_map/value_type.adoc[`value_type`] | The stored element type, a key/value pair. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:absl/linked_hash_map/2constructor-031.adoc[`linked_hash_map`] [.small]#[constructor]# | Constructors | xref:absl/linked_hash_map/operator_assign-04.adoc[`operator=`] | Assignment operators | xref:absl/linked_hash_map/at-07.adoc[`at`] | `at` overloads | xref:absl/linked_hash_map/back-0d.adoc[`back`] | `back` overloads | xref:absl/linked_hash_map/begin-06.adoc[`begin`] | `begin` overloads | xref:absl/linked_hash_map/bucket_count.adoc[`bucket_count`] | Returns the number of buckets in the underlying hash set. | xref:absl/linked_hash_map/capacity.adoc[`capacity`] | Returns the number of elements the map can hold without rehashing. | xref:absl/linked_hash_map/cbegin.adoc[`cbegin`] | Returns a const iterator to the first element. | xref:absl/linked_hash_map/cend.adoc[`cend`] | Returns a const iterator past the last element. | xref:absl/linked_hash_map/clear.adoc[`clear`] | Removes all elements from the map. | xref:absl/linked_hash_map/contains.adoc[`contains`] | Returns whether the map contains an element with the given key. | xref:absl/linked_hash_map/count.adoc[`count`] | Returns the number of elements with the given key. | xref:absl/linked_hash_map/crbegin.adoc[`crbegin`] | Returns a const reverse iterator to the last element. | xref:absl/linked_hash_map/crend.adoc[`crend`] | Returns a const reverse iterator before the first element. | xref:absl/linked_hash_map/emplace.adoc[`emplace`] | Constructs an element in place if the key is not already present. | xref:absl/linked_hash_map/emplace_hint.adoc[`emplace_hint`] | Constructs an element in place if the key is not present, ignoring the position hint. | xref:absl/linked_hash_map/empty.adoc[`empty`] | Returns whether the map is empty. | xref:absl/linked_hash_map/end-0f.adoc[`end`] | `end` overloads | xref:absl/linked_hash_map/equal_range-034.adoc[`equal_range`] | Returns the range of elements matching the given key. | xref:absl/linked_hash_map/erase-01.adoc[`erase`] | `erase` overloads | xref:absl/linked_hash_map/extract-01.adoc[`extract`] | `extract` overloads | xref:absl/linked_hash_map/find-04.adoc[`find`] | Finds the element with the given key. | xref:absl/linked_hash_map/front-00.adoc[`front`] | `front` overloads | xref:absl/linked_hash_map/get_allocator.adoc[`get_allocator`] | Returns the allocator used by the map. | xref:absl/linked_hash_map/hash_function.adoc[`hash_function`] | Returns the hash function used by the map. | xref:absl/linked_hash_map/insert-00.adoc[`insert`] | `insert` overloads | xref:absl/linked_hash_map/insert_or_assign-0c.adoc[`insert_or_assign`] | `insert_or_assign` overloads | xref:absl/linked_hash_map/key_eq.adoc[`key_eq`] | Returns the key equality comparison used by the map. | xref:absl/linked_hash_map/load_factor.adoc[`load_factor`] | Returns the current load factor of the underlying hash set. | xref:absl/linked_hash_map/max_size.adoc[`max_size`] | Returns the maximum number of elements the map can hold. | xref:absl/linked_hash_map/merge-03.adoc[`merge`] | Merges the elements of another map into this one. | xref:absl/linked_hash_map/operator_subs-0a.adoc[`operator[]`] | Returns a reference to the value mapped to the given key, inserting a default‐constructed value if the key is not present. | xref:absl/linked_hash_map/pop_back.adoc[`pop_back`] | Removes the last element from the map. | xref:absl/linked_hash_map/pop_front.adoc[`pop_front`] | Removes the first element from the map. | xref:absl/linked_hash_map/rbegin-0a.adoc[`rbegin`] | `rbegin` overloads | xref:absl/linked_hash_map/rehash.adoc[`rehash`] | Rehashes the map so it can hold at least `n` elements without rehashing. | xref:absl/linked_hash_map/rend-0f.adoc[`rend`] | `rend` overloads | xref:absl/linked_hash_map/reserve.adoc[`reserve`] | Reserves capacity for at least `n` elements. | xref:absl/linked_hash_map/size.adoc[`size`] | Returns the number of elements in the map. | xref:absl/linked_hash_map/splice.adoc[`splice`] | Moves an element from another map into this one at the given position. | xref:absl/linked_hash_map/swap.adoc[`swap`] | Swaps the contents of this map with another. | xref:absl/linked_hash_map/try_emplace-0f.adoc[`try_emplace`] | `try_emplace` overloads |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:absl/operator_not_eq-069.adoc[absl::operator!=]` | Returns whether two maps differ in their key/value pairs. | `xref:absl/operator_eq-040.adoc[absl::operator==]` | Returns whether two maps contain the same key/value pairs. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#