[#bsl-unordered_map-02b-2constructor-0f0] = xref:bsl.adoc[bsl]::xref:bsl/unordered_map-02b.adoc[unordered_map]::unordered_map :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_unorderedmap.h>` Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-0c.adoc[unordered_map](); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0c.adoc[_» 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. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-03.adoc[unordered_map](xref:bsl/unordered_map-02b.adoc[unordered_map] const& original); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-03.adoc[_» 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. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-05.adoc[unordered_map](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<unordered_map>] original); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-05.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/unordered_map-02b/2constructor-04.adoc[unordered_map](ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-04.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-06.adoc[unordered_map]( xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-06.adoc[_» 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). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-0ee.adoc[unordered_map]( xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<unordered_map>] original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0ee.adoc[_» 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 *`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-093.adoc[unordered_map]( xref:bsl/unordered_map-02b.adoc[unordered_map] const& original, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-093.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> requires bsl::IsStdAllocator_v<ALLOCATOR> xref:bsl/unordered_map-02b/2constructor-0a.adoc[unordered_map]( std::initializer_list<value_type> values, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0a.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/unordered_map-02b/2constructor-0fd.adoc[unordered_map]( xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, HASH const& hashFunction, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0fd.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> requires bsl::IsStdAllocator_v<ALLOCATOR> xref:bsl/unordered_map-02b/2constructor-0b.adoc[unordered_map]( std::initializer_list<value_type> values, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0b.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/unordered_map-02b/2constructor-095.adoc[unordered_map]( INPUT_ITERATOR first, INPUT_ITERATOR last, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-095.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/unordered_map-02b/2constructor-0fb.adoc[unordered_map]( std::from_range_t, RANGE&& range, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0fb.adoc[_» 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). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- explicit xref:bsl/unordered_map-02b/2constructor-07b.adoc[unordered_map]( xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, HASH const& hashFunction = HASH(), EQUAL const& keyEqual = EQUAL(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-07b.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> requires std::is_invocable_v<HASH, const KEY &> && bsl::IsStdAllocator_v<ALLOCATOR> xref:bsl/unordered_map-02b/2constructor-028.adoc[unordered_map]( std::initializer_list<value_type> values, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, HASH const& hashFunction, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-028.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/unordered_map-02b/2constructor-00.adoc[unordered_map]( INPUT_ITERATOR first, INPUT_ITERATOR last, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-00.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/unordered_map-02b/2constructor-085.adoc[unordered_map]( std::from_range_t, RANGE&& range, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-085.adoc[_» 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. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> requires std::is_invocable_v<HASH, const KEY &> && std::is_invocable_v<EQUAL, const KEY &, const KEY &> && bsl::IsStdAllocator_v<ALLOCATOR> xref:bsl/unordered_map-02b/2constructor-02a.adoc[unordered_map]( std::initializer_list<value_type> values, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets = 0, HASH const& hashFunction = HASH(), EQUAL const& keyEqual = EQUAL(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-02a.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/unordered_map-02b/2constructor-0ef.adoc[unordered_map]( INPUT_ITERATOR first, INPUT_ITERATOR last, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, HASH const& hashFunction, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-0ef.adoc[_» more..._]# Same as the preceding overload. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/unordered_map-02b/2constructor-08d.adoc[unordered_map]( std::from_range_t, RANGE&& range, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets, HASH const& hashFunction, ALLOCATOR const& basicAllocator); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-08d.adoc[_» 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). [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITERATOR> xref:bsl/unordered_map-02b/2constructor-09b.adoc[unordered_map]( INPUT_ITERATOR first, INPUT_ITERATOR last, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets = 0, HASH const& hashFunction = HASH(), EQUAL const& keyEqual = EQUAL(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-09b.adoc[_» 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`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class RANGE> xref:bsl/unordered_map-02b/2constructor-076.adoc[unordered_map]( std::from_range_t, RANGE&& range, xref:bsl/unordered_map-02b/size_type.adoc[size_type] initialNumBuckets = 0, HASH const& hashFunction = HASH(), EQUAL const& keyEqual = EQUAL(), ALLOCATOR const& basicAllocator = ALLOCATOR()); ---- [.small]#xref:bsl/unordered_map-02b/2constructor-076.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#