bsl::unordered_set<Attribute, AttributeHash>

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 unordered_set<Attribute, AttributeHash>;

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

NameDescription
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

NameDescription
unordered_set [constructor]Constructors
~unordered_set [destructor]Destroy this object.
operator= Assignment operators
begin begin overloads
bucket Return the index of the bucket, in the array of buckets of this container, where a value equivalent to the specified key would be inserted.
bucket_count Return the number of buckets in the array of buckets maintained by this set.
bucket_size Return the number of elements contained in the bucket at the specified index in the array of buckets maintained by this container.
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 Return true if this unordered set contains an element whose key is equivalent to the specified key.
count count overloads
emplace Insert into this unordered set a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, if a key equivalent to such a value does not already exist in this set; otherwise, this method has no effect (other than possibly creating a temporary value_type object). Return a pair whose first member is an iterator referring to the (possibly newly created and inserted) object in this set whose value is equivalent to that of an object constructed from arguments, and whose second member is true if a new value was inserted, and false if an equivalent key was already present. This method requires that the (template parameter) type KEY be emplace-constructible into this set from arguments (see {Requirements on KEY}).
emplace_hint Insert into this unordered set a newly created value_type object, constructed by forwarding get_allocator() (if required) and the specified (variable number of) arguments to the corresponding constructor of value_type, if a key equivalent to such a value does not already exists in this set; otherwise, this method has no effect (other than possibly creating a temporary value_type object). Return an iterator referring to the (possibly newly created and inserted) object in this set whose value is equivalent to that of an object constructed from arguments. The average and worst case complexity of this operation is not affected by the specified hint. This method requires that the (template parameter) type KEY be emplace-constructible into this set from arguments (see {Requirements on KEY}). The behavior is undefined unless hint is an iterator in the range [begin() .. end()] (both endpoints included). Note that hint is ignored (other than possibly asserting its validity in some build modes).
empty Return true if this set contains no elements, and false otherwise.
end end overloads
equal_range equal_range overloads
erase erase overloads
find find overloads
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 into this set the value of each value_type object in the specified range if a key equivalent to the object is not already contained in this set. The (template parameter) type RANGE must meet the requirements the C++20 standard [ranges]providing access to values of a type convertible to value_type, and value_type must be emplace-constructible from *i into this set, where i is a dereferenceable iterator obtained from range (see {Requirements on KEY}). The behavior is undefined if range overlaps this set.
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 ratio between the size of this container and the number of buckets. The load_factor is a measure of how full the container is, and a higher load factor leads to an increased number of collisions, thus resulting in a loss performance.
max_bucket_count Return a theoretical upper bound on the largest number of buckets that this container could possibly manage. Note that there is no guarantee that the set can successfully grow to the returned size, or even close to that size without running out of resources.
max_load_factor max_load_factor overloads
max_size Return a theoretical upper bound on the largest number of elements that this set could possibly hold. Note that there is no guarantee that the set can successfully grow to the returned size, or even close to that size without running out of resources.
rehash Change the size of the array of buckets maintained by this container to the specified numBuckets, and redistribute all the contained elements into the new sequence of buckets, according to their hash values. Note that this operation has no effect if rehashing the elements into numBuckets would cause this set to exceed its max_load_factor.
reserve Increase the number of buckets of this set to a quantity such that the ratio between the specified numElements and this quantity does not exceed max_load_factor. Note that this guarantees that, after the reserve, elements can be inserted to grow the container to size() == numElements without rehashing. Also note that memory allocations may still occur when growing the container to size() == numElements. Also note that this operation has no effect if numElements <= size().
size Return the number of elements in this set.
swap Exchange the value, hasher, key-equality functor, and max_load_factor of this object with those of the specified other object; also exchange the allocator of this object with that of other if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This method provides the no-throw exception-safety guarantee if and only if both the (template parameter) types HASH and EQUAL provide no-throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless either this object was created with the same allocator as other or ALLOCATOR has the propagate_on_container_swap trait.
operator BloombergLP::bslmf::NestedTraitDeclaration<unordered_set<Attribute, AttributeHash>, IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value>

Friends

NameDescription
bsl::operator==Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two unordered_set objects have the same value if they have the same number of value-elements, and for each value-element that is contained in lhs there is a value-element contained in rhs having the same value, and vice-versa. Note that this method requires that the (template parameter) type KEY be equality-comparable (see {Requirements on KEY}).