BloombergLP::bdlc::FlatHashMap

Unordered map of unique keys to mapped values with open-addressed storage.

Synopsis

Declared in <bdlc_flathashmap.h>

template<
    class KEY,
    class VALUE,
    class HASH = bslh::FibonacciBadHashWrapper<bsl::hash<KEY>>,
    class EQUAL = bsl::equal_to<KEY>>
class FlatHashMap;

Description

This class template implements a value-semantic container type holding an unordered map of KEY-VALUE pairs having unique keys that provides a mapping from keys of (template parameter) type KEY to their associated mapped values of (template parameter) type VALUE. The (template parameter) type HASH is a functor providing the hash value for KEY. The (template parameter) type EQUAL is a functor providing the equality function for two KEY values. See {Requirements on KEY, HASH, and EQUAL} for more information.

Type Aliases

NameDescription
const_iterator Iterator over non-modifiable elements.
const_pointer Pointer to a non-modifiable value.
const_reference Reference to a non-modifiable value.
difference_type Signed type used for iterator distances.
hasher Hash functor type.
iterator Iterator over modifiable elements.
key_compare Key equality predicate type.
key_type Key type of this map.
mapped_type Mapped value type of this map.
pointer Pointer to a modifiable value.
reference Reference to a modifiable value.
size_type Unsigned type used for sizes and capacities.
value_type Element type stored by this map (const KEY, VALUE pair).

Member Functions

NameDescription
FlatHashMap [constructor]Constructors
~FlatHashMap [destructor]Destroy this object and each of its elements.
operator= Assignment operators
allocator Return the allocator used by this flat hash map to supply memory.
at at overloads
begin begin overloads
capacity Return the number of elements this map could hold if the load factor were 1.
cbegin Return a const_iterator to the first element in the sequence of elements maintained by this map, or the end iterator if this map is empty.
cend Return a const_iterator to the past-the-end element in the sequence of elements maintained by this map.
clear Remove all elements from this map.
contains Return whether this map contains an element with key.
count Return the number of elements with the specified key.
emplace Emplace a newly constructed element into this map.
emplace_hint Emplace a newly constructed element using a placement hint.
empty Return true if this map contains no elements, and false otherwise.
end end overloads
equal_range equal_range overloads
erase erase overloads
find Return an iterator to the element with the specified key.
hash_function Return (a copy of) the unary hash functor used by this map to generate a hash value (of type bsl::size_t) for a KEY object.
insert insert overloads
insert_or_assign insert_or_assign overloads
key_eq Return (a copy of) the binary key-equality functor that returns true if the value of two KEY objects are equivalent, and false otherwise.
load_factor Return the current ratio between the number of elements in this container and its capacity.
max_load_factor Return the maximum load factor allowed for this map.
operator[] Return a modifiable reference to the mapped value for key.
print Format this map to the specified output stream.
rehash Rehash this map to at least the specified minimumCapacity.
reserve Reserve capacity for at least the specified numEntries.
reset Remove all elements from this map and release all memory from this map, returning the map to the default constructed state.
size Return the number of elements in this map.
swap Exchange the value of this map with that of other.
try_emplace try_emplace overloads

Friends

NameDescription
BloombergLP::bdlc::swapExchange the contents of the two maps.
BloombergLP::bdlc::operator!=Return whether the maps differ in key/value contents.
BloombergLP::bdlc::operator==Return whether the maps have the same key/value contents.

Non-Member Functions

NameDescription
operator!=Return whether lhs and rhs do not have the same value.
operator==Return whether lhs and rhs have the same value.
swapExchange the value of a with that of b.