This class template provides a flat hash table implementation useful for implementing a flat hash set and flat hash map.

Synopsis

Declared in <bdlc_flathashtable.h>

template<
    class KEY,
    class ENTRY,
    class ENTRY_UTIL,
    class HASH,
    class EQUAL>
class FlatHashTable;

Type Aliases

Name

Description

const_iterator

Iterator providing non‐modifiable access to entries.

entry_type

Entry type stored by this table.

entry_util_type

Utility type for constructing entries and extracting keys.

hash_type

Hash functor type.

iterator

Iterator providing modifiable access to entries.

key_equal_type

Key equality predicate type.

key_type

Key type used by this table.

Member Functions

Name

Description

FlatHashTable [constructor]

Constructors

~FlatHashTable [destructor]

Destroy this object and each of its entries.

operator=

Assignment operators

allocator

Return the allocator used by this hash table to supply memory.

begin

Return an iterator representing the beginning of the sequence of entries held by this container.

capacity

Return the number of elements this table could hold if the load factor were 1.

cbegin

Return an iterator representing the beginning of the sequence of entries held by this container.

cend

Return an iterator representing one past the end of the sequence of entries held by this container.

clear

Remove all entries from this table.

contains

Return true if this table contains an entry having the specified key, and false otherwise.

controls

Return the address of the underlying control array, or 0.

count

Return the number of objects in this table having the specified key.

emplace

Emplace an ENTRY constructed from args into this table.

empty

Return true if this table contains no entries, and false otherwise.

end

Return an iterator representing one past the end of the sequence of entries held by this container.

entries

Return the address of the underlying entries array, or 0.

equal_range

equal_range overloads

erase

erase overloads

find

find overloads

hash_function

Return (a copy of) the unary hash functor used by this flat hash table to generate a hash value (of type `bsl::size_t) for a `KEY' object.

insert

insert overloads

insertTransparent

Insert an entry for key if no equivalent key is already present.

key_eq

Return (a copy of) the binary key‐equality functor used by this flat hash table that returns true if two KEY objects are equal, and false otherwise.

load_factor

Return the current ratio between the number of elements in this table and its capacity.

max_load_factor

Return the maximum load factor allowed for this table.

operator[]

Return a reference to the entry for key, inserting one if needed.

rehash

Change the capacity to at least minimumCapacity and rehash.

reserve

Reserve capacity for at least the specified numEntries.

reset

Remove all entries from this table and release all memory from this table, returning the table to the zero‐capacity state.

size

Return the number of entries in this table.

swap

Efficiently exchange the value of this table with other.

try_emplace

Insert a newly constructed entry for key unless an equivalent key exists.

Static Data Members

Name

Description

k_HASHLET_MASK

Mask used to extract the seven‐bit hashlet from a hash value.

k_MAX_LOAD_FACTOR_DENOMINATOR

Denominator of the fraction that specifies the maximum load factor.

k_MAX_LOAD_FACTOR_NUMERATOR

Numerator of the fraction that specifies the maximum load factor.

k_MIN_CAPACITY

Minimum non‐zero capacity of a table.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs objects do not have the same value, and false otherwise.

operator==

Return true if the specified lhs and rhs objects have the same value, and false otherwise.

swap

Exchange the values of the specified a and b objects.

Created with MrDocs