[#bsl-unordered_set-0d2d] = xref:bsl.adoc[bsl]::unordered_set :relfileprefix: ../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class KEY, class HASH = xref:bsl/hash-06.adoc[bsl::hash<KEY>], class EQUAL = xref:bsl/equal_to-0d.adoc[bsl::equal_to<KEY>], class ALLOCATOR = xref:bsl/allocator-0df.adoc[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 [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_set-0d2d/allocator_type.adoc[`allocator_type`] | This `typedef` is an alias to the (template parameter) `ALLOCATOR`. | xref:bsl/unordered_set-0d2d/const_iterator.adoc[`const_iterator`] | This `typedef` is an alias to `iterator`. | xref:bsl/unordered_set-0d2d/const_local_iterator.adoc[`const_local_iterator`] | This `typedef` is an alias to `local_iterator`. | xref:bsl/unordered_set-0d2d/const_pointer.adoc[`const_pointer`] | This `typedef` is an alias to the allocator const‐pointer type. | xref:bsl/unordered_set-0d2d/const_reference.adoc[`const_reference`] | This `typedef` is an alias to `const value_type&`. | xref:bsl/unordered_set-0d2d/difference_type.adoc[`difference_type`] | This `typedef` is an alias to the allocator difference type. | xref:bsl/unordered_set-0d2d/hasher.adoc[`hasher`] | This `typedef` is an alias to the (template parameter) `HASH` type. | xref:bsl/unordered_set-0d2d/iterator.adoc[`iterator`] | This `typedef` is an alias to the hash‐table iterator type. | xref:bsl/unordered_set-0d2d/key_equal.adoc[`key_equal`] | This `typedef` is an alias to the (template parameter) `EQUAL` type. | xref:bsl/unordered_set-0d2d/key_type.adoc[`key_type`] | This `typedef` is an alias to the (template parameter) `KEY` type. | xref:bsl/unordered_set-0d2d/local_iterator.adoc[`local_iterator`] | This `typedef` is an alias for `local_iterator`. | xref:bsl/unordered_set-0d2d/pointer.adoc[`pointer`] | This `typedef` is an alias to the allocator pointer type. | xref:bsl/unordered_set-0d2d/reference.adoc[`reference`] | This `typedef` is an alias to `value_type&`. | xref:bsl/unordered_set-0d2d/size_type.adoc[`size_type`] | This `typedef` is an alias to the allocator size type. | xref:bsl/unordered_set-0d2d/value_type.adoc[`value_type`] | This `typedef` is an alias to `key_type`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_set-0d2d/2constructor-059.adoc[`unordered_set`] [.small]#[constructor]# | Constructors | xref:bsl/unordered_set-0d2d/2destructor.adoc[`~unordered_set`] [.small]#[destructor]# | Destroy this object. | xref:bsl/unordered_set-0d2d/operator_assign-0e.adoc[`operator=`] | Assignment operators | xref:bsl/unordered_set-0d2d/begin-0f.adoc[`begin`] | `begin` overloads | xref:bsl/unordered_set-0d2d/bucket-0d.adoc[`bucket`] | Return the bucket index for the specified `key`. | xref:bsl/unordered_set-0d2d/bucket_count.adoc[`bucket_count`] | Return the number of buckets in the array of buckets maintained by this set. | xref:bsl/unordered_set-0d2d/bucket_size.adoc[`bucket_size`] | Return the number of elements in the bucket at `index`. | xref:bsl/unordered_set-0d2d/cbegin-07.adoc[`cbegin`] | `cbegin` overloads | xref:bsl/unordered_set-0d2d/cend-0c.adoc[`cend`] | `cend` overloads | xref:bsl/unordered_set-0d2d/clear.adoc[`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. | xref:bsl/unordered_set-0d2d/contains-05.adoc[`contains`] | `contains` overloads | xref:bsl/unordered_set-0d2d/count-0ca.adoc[`count`] | Return the number of elements equivalent to `key`. | xref:bsl/unordered_set-0d2d/emplace.adoc[`emplace`] | Emplace a newly constructed element if the key is missing. | xref:bsl/unordered_set-0d2d/emplace_hint.adoc[`emplace_hint`] | Emplace a newly constructed element using `hint` if the key is missing. | xref:bsl/unordered_set-0d2d/empty.adoc[`empty`] | Return `true` if this set contains no elements, and `false` otherwise. | xref:bsl/unordered_set-0d2d/end-0b.adoc[`end`] | `end` overloads | xref:bsl/unordered_set-0d2d/equal_range-04f.adoc[`equal_range`] | Return the range of elements equivalent to `key`. | xref:bsl/unordered_set-0d2d/erase-02.adoc[`erase`] | `erase` overloads | xref:bsl/unordered_set-0d2d/find-00e.adoc[`find`] | Return an iterator to the element equivalent to `key`. | xref:bsl/unordered_set-0d2d/get_allocator.adoc[`get_allocator`] | Return (a copy of) the allocator used for memory allocation by this unordered set. | xref:bsl/unordered_set-0d2d/hash_function.adoc[`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. | xref:bsl/unordered_set-0d2d/insert-0c.adoc[`insert`] | `insert` overloads | xref:bsl/unordered_set-0d2d/insert_range.adoc[`insert_range`] | Insert values from `range` if their keys are missing. | xref:bsl/unordered_set-0d2d/key_eq.adoc[`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. | xref:bsl/unordered_set-0d2d/load_factor.adoc[`load_factor`] | Return the current load factor of this container. | xref:bsl/unordered_set-0d2d/max_bucket_count.adoc[`max_bucket_count`] | Return a theoretical upper bound on the number of buckets. | xref:bsl/unordered_set-0d2d/max_load_factor-05.adoc[`max_load_factor`] | `max_load_factor` overloads | xref:bsl/unordered_set-0d2d/max_size.adoc[`max_size`] | Return a theoretical upper bound on this set's size. | xref:bsl/unordered_set-0d2d/rehash.adoc[`rehash`] | Rehash this set to have at least `numBuckets` buckets. | xref:bsl/unordered_set-0d2d/reserve.adoc[`reserve`] | Reserve capacity for at least `numElements` elements. | xref:bsl/unordered_set-0d2d/size.adoc[`size`] | Return the number of elements in this set. | xref:bsl/unordered_set-0d2d/swap.adoc[`swap`] | Exchange the contents of this set with `other`. | xref:bsl/unordered_set-0d2d/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<unordered_set, IsBitwiseMoveable, ::BloombergLP::bslmf::IsBitwiseMoveable<HashTable>::value>`] | Return the nested trait declaration for `bslmf::IsBitwiseMoveable`. |=== == Deduction Guides [cols="1,4"] |=== | Name| Description | xref:bsl/unordered_set-0c5.adoc[`unordered_set<KEY>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0b5.adoc[`unordered_set<KEY>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0f.adoc[`unordered_set<KEY>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-05.adoc[`unordered_set<KEY>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-0d25.adoc[`unordered_set<KEY, HASH>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0c2.adoc[`unordered_set<KEY, HASH>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-088.adoc[`unordered_set<KEY, HASH, EQUAL>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-02f.adoc[`unordered_set<KEY, HASH, EQUAL>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-0b4.adoc[`unordered_set<KEY, HASH, EQUAL, ALLOCATOR>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0e.adoc[`unordered_set<KEY, HASH, EQUAL, ALLOCATOR>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-07.adoc[`unordered_set<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-087.adoc[`unordered_set<KEY, HASH, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-048.adoc[`unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0d0.adoc[`unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from initializer_list `value_type`. | xref:bsl/unordered_set-0ce.adoc[`unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from iterator `value_type`. | xref:bsl/unordered_set-04b.adoc[`unordered_set<KEY, bsl::hash<KEY>, bsl::equal_to<KEY>, ALLOCATOR>`] | CTAD guide: deduce `KEY` from iterator `value_type`. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:bsl/operator_eq-087.adoc[bsl::operator==]` | Return `true` if the specified `lhs` and `rhs` objects have the same value, and `false` otherwise. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/erase_if-0d.adoc[`erase_if`] | Erase elements from `s` that satisfy `predicate`. | xref:bsl/operator_eq-0b3.adoc[`operator==`] | Return `true` if `lhs` and `rhs` have the same value, and `false` otherwise. | xref:bsl/swap-05b.adoc[`swap`] | Exchange the contents of `a` and `b`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#