bsl::unordered_map::unordered_map

Constructors

Synopses

Declared in <bslstl_unorderedmap.h>

Same as the preceding overload.

unordered_map();
» more...

Create an unordered map having the same value, hasher, key-equality comparator, and max_load_factor as the specified original. Use the allocator returned by 'bsl::allocator_traits<ALLOCATOR>:: select_on_container_copy_construction(original.get_allocator())' to supply memory. If the ALLOCATOR type is bsl::allocator (the default), the currently installed default allocator is used to supply memory.

unordered_map(unordered_map const& original);
» more...

Create an unordered map having the same value as the specified original object by moving (in constant time) the contents of original to the new unordered map. Use a copy of original.hash_function() to generate hash values for the keys contained in this unordered map. Use a copy of original.key_eq() to verify that two keys are equivalent. The allocator associated with original is propagated for use in the newly-created unordered map. original is left in a valid but unspecified state.

unordered_map(BloombergLP::bslmf::MovableRef<unordered_map> original);
» more...

Same as the preceding overload.

explicit
unordered_map(ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

unordered_map(
    size_type initialNumBuckets,
    ALLOCATOR const& basicAllocator);
» more...

Create an unordered map having the same value, hasher, key-equality comparator, and max_load_factor as the specified original. Use the specified basicAllocator to supply memory. This method requires that the (template parameter) type value_type be move-insertable into this unordered_map (see {Requirements on value_type}). Note that a bslma::Allocator * can be supplied for basicAllocator if the (template parameter) ALLOCATOR type is bsl::allocator (the default).

unordered_map(
    BloombergLP::bslmf::MovableRef<unordered_map> original,
    ALLOCATOR const& basicAllocator);
» more...

Create an unordered map having the same value, hasher, key-equality comparator, and max_load_factor as the specified original, and using the specified basicAllocator to supply memory. If the ALLOCATOR type is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *.

unordered_map(
    unordered_map const& original,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<>
requires bsl::IsStdAllocator_v<ALLOCATOR>
unordered_map(
    std::initializer_list<value_type> values,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

unordered_map(
    size_type initialNumBuckets,
    HASH const& hashFunction,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<>
requires bsl::IsStdAllocator_v<ALLOCATOR>
unordered_map(
    std::initializer_list<value_type> values,
    size_type initialNumBuckets,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<class INPUT_ITERATOR>
unordered_map(
    INPUT_ITERATOR first,
    INPUT_ITERATOR last,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<class RANGE>
unordered_map(
    std::from_range_t,
    RANGE&& range,
    ALLOCATOR const& basicAllocator);
» more...

Create an empty unordered map having a max_load_factor of 1.0. Optionally specify an initialNumBuckets indicating the minimum initial size of the array of buckets of this unordered map. If initialNumBuckets is not supplied, one empty bucket shall be used and no memory allocated. Optionally specify a hashFunction used to generate the hash values associated with the KEY-VALUE pairs contained in this unordered map. 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 are equivalent. If keyEqual is not supplied, a default-constructed object of the (template parameter) type EQUAL is used. Optionally specify the basicAllocator used to supply memory. If basicAllocator is not supplied, a default-constructed object of the (template parameter) type ALLOCATOR is used. If the ALLOCATOR type is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *. If the ALLOCATOR type is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used to supply memory. Note that more than initialNumBuckets buckets may be created in order to preserve the bucket allocation strategy of the hash-table (but never fewer).

explicit
unordered_map(
    size_type initialNumBuckets,
    HASH const& hashFunction = HASH(),
    EQUAL const& keyEqual = EQUAL(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
» more...

Same as the preceding overload.

template<>
requires std::is_invocable_v<HASH, const KEY &> && bsl::IsStdAllocator_v<ALLOCATOR>
unordered_map(
    std::initializer_list<value_type> values,
    size_type initialNumBuckets,
    HASH const& hashFunction,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<class INPUT_ITERATOR>
unordered_map(
    INPUT_ITERATOR first,
    INPUT_ITERATOR last,
    size_type initialNumBuckets,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<class RANGE>
unordered_map(
    std::from_range_t,
    RANGE&& range,
    size_type initialNumBuckets,
    ALLOCATOR const& basicAllocator);
» more...

Create an empty unordered map, having a max_load_factor of 1.0, and then create a value_type object for each element in the specified values list, ignoring those having a key that appears earlier in the sequence. Optionally specify a minimum initialNumBuckets, hashFunction, keyEqual, and basicAllocator as for the range constructor.

template<>
requires std::is_invocable_v<HASH, const KEY &> && std::is_invocable_v<EQUAL, const KEY &, const KEY &> && bsl::IsStdAllocator_v<ALLOCATOR>
unordered_map(
    std::initializer_list<value_type> values,
    size_type initialNumBuckets = 0,
    HASH const& hashFunction = HASH(),
    EQUAL const& keyEqual = EQUAL(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
» more...

Same as the preceding overload.

template<class INPUT_ITERATOR>
unordered_map(
    INPUT_ITERATOR first,
    INPUT_ITERATOR last,
    size_type initialNumBuckets,
    HASH const& hashFunction,
    ALLOCATOR const& basicAllocator);
» more...

Same as the preceding overload.

template<class RANGE>
unordered_map(
    std::from_range_t,
    RANGE&& range,
    size_type initialNumBuckets,
    HASH const& hashFunction,
    ALLOCATOR const& basicAllocator);
» more...

Create an empty unordered map, having a max_load_factor of 1.0, and then create a value_type object for each iterator in the range starting at the specified first iterator and ending immediately before the specified last iterator, by converting from the object referred to by each iterator. Insert into this unordered map each such object, ignoring those having a key that appears earlier in the sequence. Optionally specify a minimum initialNumBuckets indicating the minimum initial size of the array of buckets of this unordered map. If initialNumBuckets is 0 or not supplied, and first and last denote an empty range, a single empty bucket shall be supplied. The actual number of buckets the unordered_map is created with shall always be enough to accommodate the number of elements of the range without exceeding the max_load_factor. Optionally specify a hashFunction used to generate hash values associated with the KEY-VALUE pairs contained in this unordered map. 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 verify that two keys are equivalent. 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 ALLOCATOR type is bsl::allocator (the default), then basicAllocator shall be convertible to bslma::Allocator *. If the ALLOCATOR type is bsl::allocator and basicAllocator is not supplied, the currently installed default allocator is used to supply memory. The (template parameter) type INPUT_ITERATOR shall meet the requirements of an input iterator defined in the C++11 standard [24.2.3]providing access to values of a type convertible to value_type. The behavior is undefined unless first and last refer to a sequence of valid values where first is at a position at or before last. Note that more than initialNumBuckets buckets may be created in order to preserve the bucket allocation strategy of the hash-table (but never fewer).

template<class INPUT_ITERATOR>
unordered_map(
    INPUT_ITERATOR first,
    INPUT_ITERATOR last,
    size_type initialNumBuckets = 0,
    HASH const& hashFunction = HASH(),
    EQUAL const& keyEqual = EQUAL(),
    ALLOCATOR const& basicAllocator = ALLOCATOR());
» more...

Create an unordered set, and insert each value_type object in the specified range, ignoring those keys having a key 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.

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