absl::linked_hash_map

An insertion-ordered map.

Synopsis

Declared in <absl/container/linked_hash_map.h>

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

NameDescription
allocator_type The allocator type.
const_iterator The const iterator type, iterating in insertion order.
const_pointer A const pointer to an element.
const_reference A const reference to an element.
const_reverse_iterator The const reverse iterator type.
difference_type The signed integer type for iterator differences.
hasher The hash function type for keys.
insert_return_type The return type of node-handle insertions.
iterator The iterator type, iterating in insertion order.
key_equal The equality comparison type for keys.
key_type The key type.
mapped_type The mapped value type.
node_type The node handle type used to extract and reinsert elements.
pointer A pointer to an element.
reference A reference to an element.
reverse_iterator The reverse iterator type.
size_type The unsigned integer type for sizes.
value_type The stored element type, a key/value pair.

Member Functions

NameDescription
linked_hash_map [constructor]Constructors
operator= Assignment operators
at at overloads
back back overloads
begin begin overloads
bucket_count Returns the number of buckets in the underlying hash set.
capacity Returns the number of elements the map can hold without rehashing.
cbegin Returns a const iterator to the first element.
cend Returns a const iterator past the last element.
clear Removes all elements from the map.
contains Returns whether the map contains an element with the given key.
count Returns the number of elements with the given key.
crbegin Returns a const reverse iterator to the last element.
crend Returns a const reverse iterator before the first element.
emplace Constructs an element in place if the key is not already present.
emplace_hint Constructs an element in place if the key is not present, ignoring the position hint.
empty Returns whether the map is empty.
end end overloads
equal_range Returns the range of elements matching the given key.
erase erase overloads
extract extract overloads
find Finds the element with the given key.
front front overloads
get_allocator Returns the allocator used by the map.
hash_function Returns the hash function used by the map.
insert insert overloads
insert_or_assign insert_or_assign overloads
key_eq Returns the key equality comparison used by the map.
load_factor Returns the current load factor of the underlying hash set.
max_size Returns the maximum number of elements the map can hold.
merge Merges the elements of another map into this one.
operator[] Returns a reference to the value mapped to the given key, inserting a default-constructed value if the key is not present.
pop_back Removes the last element from the map.
pop_front Removes the first element from the map.
rbegin rbegin overloads
rehash Rehashes the map so it can hold at least n elements without rehashing.
rend rend overloads
reserve Reserves capacity for at least n elements.
size Returns the number of elements in the map.
splice Moves an element from another map into this one at the given position.
swap Swaps the contents of this map with another.
try_emplace try_emplace overloads

Friends

NameDescription
absl::operator!=Returns whether two maps differ in their key/value pairs.
absl::operator==Returns whether two maps contain the same key/value pairs.