Unordered set of unique KEY values with open‐addressing storage.

Synopsis

Declared in <bdlc_flathashset.h>

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

Description

This class template implements a value‐semantic container type holding an unordered set of unique values of (template parameter) type KEY. 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

Name

Description

const_iterator

Const iterator over 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 elements (const, since set values are immutable).

key_compare

Key equality predicate type.

key_type

Key type of this set (also the element type).

pointer

Pointer to a modifiable value.

reference

Reference to a modifiable value.

size_type

Unsigned type used for sizes and capacities.

value_compare

Value equality predicate type (same as key_compare).

value_type

Element type stored by this set.

Member Functions

Name

Description

FlatHashSet [constructor]

Constructors

~FlatHashSet [destructor]

Destroy this object and each of its elements.

operator=

Assignment operators

allocator

Return the allocator used by this flat hash set to supply memory.

begin

Return a const_iterator to the first element in the sequence of elements maintained by this set, or the end iterator if this set is empty.

capacity

Return the number of elements this set 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 set, or the end iterator if this set is empty.

cend

Return a const_iterator to the past‐the‐end element in the sequence of KEY elements maintained by this set.

clear

Remove all elements from this set.

contains

contains overloads

count

count overloads

emplace

Emplace a newly constructed element into this set.

emplace_hint

Emplace a newly constructed element, using an insertion hint.

empty

Return true if this set contains no elements, and false otherwise.

end

Return a const_iterator to the past‐the‐end element in the sequence of KEY elements maintained by this set.

equal_range

equal_range overloads

erase

erase overloads

find

find overloads

hash_function

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

insert

insert 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 set.

print

Format this object to the specified output stream.

rehash

Rehash this set to at least the specified minimum capacity.

reserve

Reserve capacity for at least the specified number of entries.

reset

Remove all elements from this set and release all memory from this set, returning the set to the default constructed state.

size

Return the number of elements in this set.

swap

Exchange the value of this set with that of the specified other.

Friends

Name

Description

BloombergLP::bdlc::swap

Exchange the contents of the two sets.

BloombergLP::bdlc::operator!=

Return whether the sets differ in contents.

BloombergLP::bdlc::operator==

Return whether the sets have the same contents.

Non-Member Functions

Name

Description

operator!=

Return whether two sets do not have the same value.

operator==

Return whether two sets have the same value.

swap

Exchange the value, hasher, and key‐equality functor of two sets.

Created with MrDocs