[#bsl-unordered_set-09-2constructor-08d]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_set-09.adoc[unordered&lowbar;set&lt;Attribute, AttributeHash&gt;]::unordered&lowbar;set
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

Declared in `&lt;bslstl&lowbar;unorderedset&period;h&gt;`

Create an empty unordered set&period; Optionally specify an `initialNumBuckets` indicating the initial size of the array of buckets of this container&period; If `initialNumBuckets` is not supplied, a single bucket is used&period; Optionally specify a `hashFunction` used to generate the hash values for the keys contained in this set&period; If `hashFunction` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify a key&hyphen;equality functor `keyEqual` used to verify that two key are equivalent&period; If `keyEqual` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used to supply memory&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-04.adoc[unordered&lowbar;set]();
----

[.small]#xref:bsl/unordered_set-09/2constructor-04.adoc[_» more&period;&period;&period;_]#

Create an unordered set having the same value as the specified `original` object by moving (in constant time) the contents of `original` to the new set&period; Use a copy of `original&period;hash&lowbar;function()` to generate hash values for the keys contained in this set&period; Use a copy of `original&period;key&lowbar;eq()` to verify that two keys are equivalent&period; The allocator associated with `original` is propagated for use in the newly&hyphen;created set&period; `original` is left in a valid but unspecified state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-0df.adoc[unordered&lowbar;set](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;unordered&lowbar;set&lt;Attribute, AttributeHash&gt;&gt;] original);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0df.adoc[_» more&period;&period;&period;_]#

Create an empty unordered set using the specified `basicAllocator`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/unordered_set-09/2constructor-0f1.adoc[unordered&lowbar;set](xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0f1.adoc[_» more&period;&period;&period;_]#

Create an unordered set having the same value as the specified `original` object&period; Use a copy of `original&period;hash&lowbar;function()` to generate hash values for the keys contained in this set&period; Use a copy of `original&period;key&lowbar;eq()` to verify that two keys are equivalent&period; Use the allocator returned by &grave;bsl&colon;&colon;allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon; select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction(original&period;get&lowbar;allocator())&grave; to allocate memory&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;insertable` into this set (see &lcub;Requirements on `KEY`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-07a.adoc[unordered&lowbar;set](xref:bsl/unordered_set-0d2d.adoc[unordered&lowbar;set&lt;Attribute, AttributeHash&gt;] const& original);
----

[.small]#xref:bsl/unordered_set-09/2constructor-07a.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-020.adoc[unordered&lowbar;set](
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-020.adoc[_» more&period;&period;&period;_]#

Create an unordered set having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory&period; The contents of `original` are moved (in constant time) to the new set if `basicAllocator &equals;&equals; original&period;get&lowbar;allocator()`, and are move&hyphen;inserted (in linear time) using `basicAllocator` otherwise&period; `original` is left in a valid but unspecified state&period; Use a copy of `original&period;hash&lowbar;function()` to generate hash values for the keys contained in this set&period; Use a copy of `original&period;key&lowbar;eq()` to verify that two keys are equivalent&period; This method requires that the (template parameter) type `KEY` be `move&hyphen;insertable` (see &lcub;Requirements on `KEY`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the (template parameter) type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-0cc.adoc[unordered&lowbar;set](
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;unordered&lowbar;set&lt;Attribute, AttributeHash&gt;&gt;] original,
    type&lowbar;identity&lt;allocator&lt;Attribute&gt;&gt;::type const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0cc.adoc[_» more&period;&period;&period;_]#

Create an unordered set having the same value as the specified `original` object that uses the specified `basicAllocator` to supply memory&period; Use a copy of `original&period;hash&lowbar;function()` to generate hash values for the keys contained in this set&period; Use a copy of `original&period;key&lowbar;eq()` to verify that two keys are equivalent&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;insertable` into this set (see &lcub;Requirements on `KEY`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the (template parameter) type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-085.adoc[unordered&lowbar;set](
    xref:bsl/unordered_set-0d2d.adoc[unordered&lowbar;set&lt;Attribute, AttributeHash&gt;] const& original,
    type&lowbar;identity&lt;allocator&lt;Attribute&gt;&gt;::type const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-085.adoc[_» more&period;&period;&period;_]#

Create an unordered set and insert each `value&lowbar;type` object in the specified `values` initializer list, ignoring those keys having a value equivalent to that which appears earlier in the list&period; Optionally specify an `initialNumBuckets` indicating the initial size of the array of buckets of this container&period; If `initialNumBuckets` is not supplied, a single bucket is used&period; Optionally specify a `hashFunction` used to generate the hash values for the keys contained in this set&period; If `hashFunction` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify a key&hyphen;equality functor `keyEqual` used to verify that two keys are equivalent&period; If `keyEqual` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used to supply memory&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;constructible` (see &lcub;Requirements on `KEY`&rcub;)&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&gt;
requires bsl&colon;&colon;IsStdAllocator&lt;ALLOCATOR&gt;&colon;&colon;value
xref:bsl/unordered_set-09/2constructor-03.adoc[unordered&lowbar;set](
    std::initializer&lowbar;list&lt;Attribute&gt; values,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-03.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-09/2constructor-0c3.adoc[unordered&lowbar;set](
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0c3.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&gt;
requires bsl&colon;&colon;IsStdAllocator&lt;ALLOCATOR&gt;&colon;&colon;value
xref:bsl/unordered_set-09/2constructor-0730.adoc[unordered&lowbar;set](
    std::initializer&lowbar;list&lt;Attribute&gt; values,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0730.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/unordered_set-09/2constructor-073c.adoc[unordered&lowbar;set](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-073c.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/unordered_set-09/2constructor-072.adoc[unordered&lowbar;set](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-072.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified bucket count and hash&sol;equality functors&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
explicit
xref:bsl/unordered_set-09/2constructor-05.adoc[unordered&lowbar;set](
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction = HASH(),
    xref:bsl/equal_to-0d.adoc[equal&lowbar;to&lt;Attribute&gt;] const& keyEqual = EQUAL(),
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/unordered_set-09/2constructor-05.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&gt;
requires std&colon;&colon;is&lowbar;invocable&lowbar;v&lt;HASH, const KEY &amp;&gt; &amp;&amp; bsl&colon;&colon;IsStdAllocator&lt;ALLOCATOR&gt;&colon;&colon;value
xref:bsl/unordered_set-09/2constructor-08e.adoc[unordered&lowbar;set](
    std::initializer&lowbar;list&lt;Attribute&gt; values,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-08e.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/unordered_set-09/2constructor-0fd.adoc[unordered&lowbar;set](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0fd.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/unordered_set-09/2constructor-0de.adoc[unordered&lowbar;set](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-0de.adoc[_» more&period;&period;&period;_]#

Create an unordered set from the specified `values` initializer list&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&gt;
requires std&colon;&colon;is&lowbar;invocable&lowbar;v&lt;HASH, const KEY &amp;&gt; &amp;&amp; std&colon;&colon;is&lowbar;invocable&lowbar;v&lt;EQUAL, const KEY &amp;, const KEY &amp;&gt; &amp;&amp; bsl&colon;&colon;IsStdAllocator&lowbar;v&lt;ALLOCATOR&gt;
xref:bsl/unordered_set-09/2constructor-0a.adoc[unordered&lowbar;set](
    std::initializer&lowbar;list&lt;Attribute&gt; values,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets = 0,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction = HASH(),
    xref:bsl/equal_to-0d.adoc[equal&lowbar;to&lt;Attribute&gt;] const& keyEqual = EQUAL(),
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/unordered_set-09/2constructor-0a.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/unordered_set-09/2constructor-06.adoc[unordered&lowbar;set](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-06.adoc[_» more&period;&period;&period;_]#

Same as the preceding overload, using the specified allocator&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/unordered_set-09/2constructor-00.adoc[unordered&lowbar;set](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction,
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator);
----

[.small]#xref:bsl/unordered_set-09/2constructor-00.adoc[_» more&period;&period;&period;_]#

Create an unordered set, and insert each `value&lowbar;type` object in the sequence starting at the specified `first` element, and ending immediately before the specified `last` element, ignoring those keys having a value equivalent to that which appears earlier in the sequence&period; Optionally specify an `initialNumBuckets` indicating the initial size of the array of buckets of this container&period; If `initialNumBuckets` is not supplied, a single bucket is used&period; Optionally specify a `hashFunction` used to generate hash values for the keys contained in this set&period; If `hashFunction` is not supplied, a default&hyphen;constructed object of (template parameter) type `HASH` is used&period; Optionally specify a key&hyphen;equality functor `keyEqual` used to verify that two key values are the same&period; If `keyEqual` is not supplied, a default&hyphen;constructed object of (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used to supply memory&period; The (template parameter) type `INPUT&lowbar;ITERATOR` shall meet the requirements of an input iterator defined in the C&plus;&plus;11 standard &lsqb;24&period;2&period;3&rsqb;providing access to values of a type convertible to `value&lowbar;type`, and `value&lowbar;type` must be `emplace&hyphen;constructible` from `&ast;i` into this unordered set, where `i` is a dereferenceable iterator in the range `&lsqb;first &period;&period; last)&rsqb;` (see &lcub;Requirements on `KEY`&rcub;)&period; 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`&period; Note that a `bslma&colon;&colon;Allocator &ast;` can be supplied for `basicAllocator` if the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/unordered_set-09/2constructor-0da.adoc[unordered&lowbar;set](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets = 0,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction = HASH(),
    xref:bsl/equal_to-0d.adoc[equal&lowbar;to&lt;Attribute&gt;] const& keyEqual = EQUAL(),
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/unordered_set-09/2constructor-0da.adoc[_» more&period;&period;&period;_]#

Create an unordered set, and insert each `value&lowbar;type` object in the specified `range`, ignoring those keys having a value equivalent to that which appears earlier in the `range`&period; Optionally specify an `initialNumBuckets` indicating the initial size of the array of buckets of this container&period; If `initialNumBuckets` is not supplied, an implementation&hyphen;defined value is used&period; Optionally specify a `hashFunction` used to generate the hash values for each key value contained in this set&period; If `hashFunction` is not supplied, a default&hyphen;constructed object of the (template parameter) type `HASH` is used&period; Optionally specify a key&hyphen;equality functor `keyEqual` used to determine whether two keys have the same value&period; If `keyEqual` is not supplied, a default&hyphen;constructed object of the (template parameter) type `EQUAL` is used&period; Optionally specify a `basicAllocator` used to supply memory&period; If `basicAllocator` is not supplied, a default&hyphen;constructed object of the (template parameter) type `ALLOCATOR` is used&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` (the default), then `basicAllocator`, if supplied, shall be convertible to `bslma&colon;&colon;Allocator &ast;`&period; If the type `ALLOCATOR` is `bsl&colon;&colon;allocator` and `basicAllocator` is not supplied, the currently installed default allocator is used&period; This operation has `O&lsqb;N&rsqb;` complexity, where `N` is the number of elements in `range`&period; 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&lowbar;type`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class RANGE&gt;
xref:bsl/unordered_set-09/2constructor-027.adoc[unordered&lowbar;set](
    std::from&lowbar;range&lowbar;t,
    RANGE&& range,
    xref:bsl/unordered_set-09/size_type.adoc[size&lowbar;type] initialNumBuckets = 0,
    xref:BloombergLP/ball/DefaultAttributeContainer.adoc[AttributeHash] const& hashFunction = HASH(),
    xref:bsl/equal_to-0d.adoc[equal&lowbar;to&lt;Attribute&gt;] const& keyEqual = EQUAL(),
    xref:bsl/allocator-0df.adoc[allocator&lt;Attribute&gt;] const& basicAllocator = ALLOCATOR());
----

[.small]#xref:bsl/unordered_set-09/2constructor-027.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
