This class template implements a value‐semantic container type holding an unordered set of unique values (of template parameter type KEY).

Synopsis

Declared in <bslstl_unorderedset.h>

template<
    class KEY,
    class HASH = bsl::hash<KEY>,
    class EQUAL = bsl::equal_to<KEY>,
    class ALLOCATOR = bsl::allocator<KEY>>
class unordered_set;

Description

This class: * supports a complete set of value‐semantic operations

  • except for BDEX serialization * is exception‐neutral (agnostic except for the at method) * is alias‐safe * is const thread‐safe For terminology see {`bsldoc_glossary`}.

Type Aliases

Name

Description

allocator_type

This typedef is an alias to the (template parameter) ALLOCATOR.

const_iterator

This typedef is an alias to iterator.

const_local_iterator

This typedef is an alias to local_iterator.

const_pointer

This typedef is an alias to the allocator const‐pointer type.

const_reference

This typedef is an alias to const value_type&.

difference_type

This typedef is an alias to the allocator difference type.

hasher

This typedef is an alias to the (template parameter) HASH type.

iterator

This typedef is an alias to the hash‐table iterator type.

key_equal

This typedef is an alias to the (template parameter) EQUAL type.

key_type

This typedef is an alias to the (template parameter) KEY type.

local_iterator

This typedef is an alias for local_iterator.

pointer

This typedef is an alias to the allocator pointer type.

reference

This typedef is an alias to value_type&.

size_type

This typedef is an alias to the allocator size type.

value_type

This typedef is an alias to key_type.

Member Functions

Name

Description

unordered_set [constructor]

Constructors

~unordered_set [destructor]

Destroy this object.

operator=

Assignment operators

begin

begin overloads

bucket

Return the bucket index for the specified key.

bucket_count

Return the number of buckets in the array of buckets maintained by this set.

bucket_size

Return the number of elements in the bucket at index.

cbegin

cbegin overloads

cend

cend overloads

clear

Remove all entries from this unordered set. Note that the set is empty after this call, but allocated memory may be retained for future use.

contains

contains overloads

count

Return the number of elements equivalent to key.

emplace

Emplace a newly constructed element if the key is missing.

emplace_hint

Emplace a newly constructed element using hint if the key is missing.

empty

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

end

end overloads

equal_range

Return the range of elements equivalent to key.

erase

erase overloads

find

Return an iterator to the element equivalent to key.

get_allocator

Return (a copy of) the allocator used for memory allocation by this unordered set.

hash_function

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

insert

insert overloads

insert_range

Insert values from range if their keys are missing.

key_eq

Return (a copy of) the key‐equality binary functor that returns true if the value of two key_type objects are equivalent, and false otherwise.

load_factor

Return the current load factor of this container.

max_bucket_count

Return a theoretical upper bound on the number of buckets.

max_load_factor

max_load_factor overloads

max_size

Return a theoretical upper bound on this set's size.

rehash

Rehash this set to have at least numBuckets buckets.

reserve

Reserve capacity for at least numElements elements.

size

Return the number of elements in this set.

swap

Exchange the contents of this set with other.

operator BloombergLP::bslmf::NestedTraitDeclaration<unordered_set, IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value>

Return the nested trait declaration for bslmf::IsBitwiseMoveable.

Deduction Guides

Name

Description

unordered_set<KEY>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, HASH>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, HASH>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, HASH, EQUAL>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, HASH, EQUAL>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, HASH, EQUAL, ALLOCATOR>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, HASH, EQUAL, ALLOCATOR>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from initializer_list value_type.

unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from iterator value_type.

unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>

CTAD guide: deduce KEY from iterator value_type.

Friends

Name

Description

bsl::operator==

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

Non-Member Functions

Name

Description

erase_if

Erase elements from s that satisfy predicate.

operator==

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

swap

Exchange the contents of a and b.

Created with MrDocs