[#bsl-set-0d-insert-060]
= xref:bsl.adoc[bsl]::xref:bsl/set-0d.adoc[set]::insert
:relfileprefix: ../../
:mrdocs:

Insert `value` near `hint` if an equivalent key is not present&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/set-0d/iterator.adoc[set&lt;KEY, COMPARATOR, ALLOCATOR&gt;::iterator]
insert(
    xref:bsl/set-0d/const_iterator.adoc[const&lowbar;iterator] hint,
    xref:bsl/set-0d/value_type.adoc[value&lowbar;type] const& value);
----

== Description

Insert in amortized constant time if `hint` is a valid immediate successor to `value`&semi; otherwise this method has no effect if a key equivalent to `value` already exists&period; Return an iterator referring to the (possibly newly inserted) `value&lowbar;type` object in this set that is equivalent to `value`&period; If `hint` is not a valid immediate successor to `value`, this operation has `O&lsqb;log(N)&rsqb;` complexity, where `N` is the size of this set&period; This method requires that the (template parameter) type `KEY` be `copy&hyphen;insertable` 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;

== Return Value

iterator to the existing or newly inserted element

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hint*
| iterator hint for insertion position
| *value*
| key to insert
|===


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