Create an unordered set from the specified range.

Synopsis

Declared in <bslstl_unorderedset.h>

template<class RANGE>
unordered_set(
    std::from_range_t tag,
    RANGE&& range,
    size_type initialNumBuckets = 0,
    HASH const& hashFunction = HASH(),
    EQUAL const& keyEqual = EQUAL(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());

Description

Insert each value_type object in the specified range, ignoring those keys having a value equivalent to that which appears earlier in the range. Optionally specify an initialNumBuckets indicating the initial size of the array of buckets of this container. If initialNumBuckets is not supplied, an implementation‐defined value is used. Optionally specify a hashFunction used to generate the hash values for each key value contained in this set. If hashFunction is not supplied, a default‐constructed object of the (template parameter) type HASH is used. Optionally specify a key‐equality functor keyEqual used to determine whether two keys have the same value. If keyEqual is not supplied, a default‐constructed object of the (template parameter) type EQUAL is used. Optionally specify a basicAllocator used to supply memory. If basicAllocator is not supplied, a default‐constructed object of the (template parameter) type ALLOCATOR is used. If the type ALLOCATOR is bsl::allocator (the default), then basicAllocator, if supplied, shall be convertible to bslma::Allocator *. If the type ALLOCATOR is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used. This operation has O[N] complexity, where N is the number of elements in range. Note that RANGE must meet the requirements of an input range and the values from range must have a type matching or convertible to value_type.

Parameters

Name

Description

tag

disambiguation tag for the range constructor

range

range of values to insert

initialNumBuckets

initial number of buckets

hashFunction

hash function

keyEqual

key‐equality functor

basicAllocator

allocator used to supply memory

Created with MrDocs