[#bsl-unordered_set-02a-insert-097]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_set-02a.adoc[unordered&lowbar;set&lt;ManagedAttribute, AttributeHash&gt;]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

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

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; `value` is left in a valid but unspecified state&period; Return a pair whose `first` member is an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`, and whose `second` member is `true` if a new value was inserted, and `false` if the key was already present&period; This method requires that the (template parameter) type `KEY` be `move&hyphen;insertable` into this set (see &lcub;Requirements on `KEY`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[pair&lt;iterator, bool&gt;]
xref:bsl/unordered_set-02a/insert-01.adoc[insert](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;value&lowbar;type&gt;] value);
----

[.small]#xref:bsl/unordered_set-02a/insert-01.adoc[_» more&period;&period;&period;_]#

Insert into this set the value of each `value&lowbar;type` object in the specified `values` initializer list if a key equivalent to the object is not already contained in this set&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;insertable` (see &lcub;Requirements on `KEY`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
xref:bsl/unordered_set-02a/insert-0b.adoc[insert](std::initializer&lowbar;list&lt;ManagedAttribute&gt; values);
----

[.small]#xref:bsl/unordered_set-02a/insert-0b.adoc[_» more&period;&period;&period;_]#

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; Return a pair whose `first` member is an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`, and whose `second` member is `true` if a new value was inserted, and `false` if the key was already present&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;insertable` (see &lcub;Requirements on `KEY`&rcub;)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/pair-0b.adoc[pair&lt;iterator, bool&gt;]
xref:bsl/unordered_set-02a/insert-06.adoc[insert](xref:bsl/unordered_set-02a/value_type.adoc[value&lowbar;type] const& value);
----

[.small]#xref:bsl/unordered_set-02a/insert-06.adoc[_» more&period;&period;&period;_]#

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; `value` is left in a valid but unspecified state&period; Return a pair whose `first` member is an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`, and whose `second` member is `true` if a new value was inserted, and `false` if the key was already present&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class LOOKUP&lowbar;KEY&gt;
xref:bsl/pair-0b.adoc[pair&lt;iterator, bool&gt;]
xref:bsl/unordered_set-02a/insert-099.adoc[insert](LOOKUP&lowbar;KEY&& value)
requires BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;HASH, LOOKUP&lowbar;KEY&gt;&colon;&colon;value
        &amp;&amp; BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;EQUAL,LOOKUP&lowbar;KEY&gt;&colon;&colon;value;
----

[.small]#xref:bsl/unordered_set-02a/insert-099.adoc[_» more&period;&period;&period;_]#

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; `value` is left in a valid but unspecified state&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`&period; The average and worst case complexity of this operation is not affected by the specified `hint`&period; This method requires that the (template parameter) type `KEY` be `move&hyphen;insertable` (see &lcub;Requirements on `KEY`&rcub;) into this set&period; The behavior is undefined unless `hint` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period; Note that `hint` is ignored (other than possibly asserting its validity in some build modes)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-02a/iterator.adoc[iterator]
xref:bsl/unordered_set-02a/insert-00.adoc[insert](
    xref:bsl/unordered_set-02a/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;value&lowbar;type&gt;] value);
----

[.small]#xref:bsl/unordered_set-02a/insert-00.adoc[_» more&period;&period;&period;_]#

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`&period; The average and worst case complexity of this operation is not affected by the specified `hint`&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;constructible` into this set (see &lcub;Requirements on `KEY`&rcub;)&period; The behavior is undefined unless `hint` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period; Note that `hint` is ignored (other than possibly asserting its validity in some build modes)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-02a/iterator.adoc[iterator]
xref:bsl/unordered_set-02a/insert-0f.adoc[insert](
    xref:bsl/unordered_set-02a/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:bsl/unordered_set-02a/value_type.adoc[value&lowbar;type] const& value);
----

[.small]#xref:bsl/unordered_set-02a/insert-0f.adoc[_» more&period;&period;&period;_]#

Insert into this set the value of each `value&lowbar;type` object in the range starting at the specified `first` iterator and ending immediately before the specified `last` iterator, if a key equivalent to the object is not already contained in this set&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 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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
void
xref:bsl/unordered_set-02a/insert-04.adoc[insert](
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last);
----

[.small]#xref:bsl/unordered_set-02a/insert-04.adoc[_» more&period;&period;&period;_]#

Insert the specified `value` into this set if a key equivalent to `value` does not already exist in this set&semi; otherwise, if a key equivalent to `value` already exists in this set, this method has no effect&period; `value` is left in a valid but unspecified state&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`&period; The average and worst case complexity of this operation is not affected by the specified `hint`&period; This method requires that the (template parameter) type `KEY` be `move&hyphen;insertable` (see &lcub;Requirements on `KEY`&rcub;) into this set&period; The behavior is undefined unless `hint` is an iterator in the range `&lsqb;begin() &period;&period; end()&rsqb;` (both endpoints included)&period; Note that `hint` is ignored (other than possibly asserting its validity in some build modes)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class LOOKUP&lowbar;KEY&gt;
xref:bsl/unordered_set-02a/iterator.adoc[iterator]
xref:bsl/unordered_set-02a/insert-0c.adoc[insert](
    xref:bsl/unordered_set-02a/const_iterator.adoc[const&lowbar;iterator],
    LOOKUP&lowbar;KEY&& value)
requires BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;HASH, LOOKUP&lowbar;KEY&gt;&colon;&colon;value
        &amp;&amp; BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;EQUAL,LOOKUP&lowbar;KEY&gt;&colon;&colon;value
        &amp;&amp; !bsl&colon;&colon;is&lowbar;convertible&lt;LOOKUP&lowbar;KEY&amp;&amp;, iterator&gt;&colon;&colon;value
        &amp;&amp; !bsl&colon;&colon;is&lowbar;convertible&lt;LOOKUP&lowbar;KEY&amp;&amp;, const&lowbar;iterator&gt;&colon;&colon;value;
----

[.small]#xref:bsl/unordered_set-02a/insert-0c.adoc[_» more&period;&period;&period;_]#


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