absl::linked_hash_set

A simple insertion-ordered set.

Synopsis

Declared in <absl/container/linked_hash_set.h>

template<
    typename Key,
    typename KeyHash = absl::flat_hash_set<Key>::hasher,
    typename KeyEq = absl::flat_hash_set<Key, KeyHash>::key_equal,
    typename Alloc = std::allocator<Key>>
class linked_hash_set;

Description

Provides O(1) amortized insertions and lookups, as well as iteration over the set in the insertion order. This class is thread-compatible but NOT exception-safe, and 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 difference type.
hasher The hash functor type.
insert_return_type The return type of node-handle insertions.
iterator The iterator type, iterating in insertion order.
key_equal The key equality functor type.
key_type The key type of the set.
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 size type.
value_type The value type stored in the set.

Member Functions

NameDescription
linked_hash_set [constructor]Constructors
operator= Assignment operators
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 set can hold without rehashing.
cbegin Returns a const iterator to the first element, in insertion order.
cend Returns a const iterator past the last element.
clear Removes all elements from the set.
contains Returns whether the set contains an element with the given key.
count Returns the number of elements matching the given key.
crbegin Returns a const reverse iterator to the last element.
crend Returns a const reverse iterator past the first element.
emplace Constructs an element in place in the set.
emplace_hint Constructs an element in place in the set using a position hint.
empty Returns whether the set 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.
hash_function Returns the hash functor.
insert insert overloads
key_eq Returns the key equality functor.
load_factor Returns the current load factor of the underlying hash set.
max_size Returns the maximum number of elements the set can hold.
merge Merges the elements of another set into this one.
pop_back Removes the last element from the set.
pop_front Removes the first element from the set.
rbegin rbegin overloads
rehash Rehashes the underlying hash set to hold at least n buckets.
rend rend overloads
reserve Reserves space for at least n elements.
size Returns the number of elements in the set.
swap Swaps the contents of this set with another.

Friends

NameDescription
absl::operator!=Returns whether two sets contain different elements.
absl::operator==Returns whether two sets contain the same elements.