[#bsl-list-054-insert-0a5]
= xref:bsl.adoc[bsl]::xref:bsl/list-054.adoc[list]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

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

Insert the move&hyphen;insertable `value` at `dstPosition`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/list-054/iterator.adoc[list&lt;VALUE, ALLOCATOR&gt;::iterator]
xref:bsl/list-054/insert-0c.adoc[insert](
    xref:bsl/list-054/const_iterator.adoc[const&lowbar;iterator] dstPosition,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;value&lowbar;type&gt;] value);
----

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

Insert the values from `values` at the specified `dstPosition`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/list-054/iterator.adoc[list&lt;VALUE, ALLOCATOR&gt;::iterator]
xref:bsl/list-054/insert-00.adoc[insert](
    xref:bsl/list-054/const_iterator.adoc[const&lowbar;iterator] dstPosition,
    std::initializer&lowbar;list&lt;value&lowbar;type&gt; values);
----

[.small]#xref:bsl/list-054/insert-00.adoc[_» more&period;&period;&period;_]#

Insert a copy of `value` at `dstPosition` and return an iterator to it&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/list-054/iterator.adoc[list&lt;VALUE, ALLOCATOR&gt;::iterator]
xref:bsl/list-054/insert-06.adoc[insert](
    xref:bsl/list-054/const_iterator.adoc[const&lowbar;iterator] dstPosition,
    xref:bsl/list-054/value_type.adoc[value&lowbar;type] const& value);
----

[.small]#xref:bsl/list-054/insert-06.adoc[_» more&period;&period;&period;_]#

Insert `numElements` copies of `value` at `dstPosition`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/list-054/iterator.adoc[list&lt;VALUE, ALLOCATOR&gt;::iterator]
xref:bsl/list-054/insert-0ab.adoc[insert](
    xref:bsl/list-054/const_iterator.adoc[const&lowbar;iterator] dstPosition,
    xref:bsl/list-054/size_type.adoc[size&lowbar;type] numElements,
    xref:bsl/list-054/value_type.adoc[value&lowbar;type] const& value);
----

[.small]#xref:bsl/list-054/insert-0ab.adoc[_» more&period;&period;&period;_]#

Insert the values in `&lsqb;first &period;&period; last)&rsqb;` at the specified `dstPosition`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITERATOR&gt;
xref:bsl/list-054/iterator.adoc[iterator]
xref:bsl/list-054/insert-0e.adoc[insert](
    xref:bsl/list-054/const_iterator.adoc[const&lowbar;iterator] dstPosition,
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last)
requires !is&lowbar;arithmetic&lt;INPUT&lowbar;ITERATOR&gt;&colon;&colon;value &amp;&amp;
                        !is&lowbar;enum&lt;INPUT&lowbar;ITERATOR&gt;&colon;&colon;value;
----

[.small]#xref:bsl/list-054/insert-0e.adoc[_» more&period;&period;&period;_]#

== Return Value

* iterator to the newly inserted element
* iterator to the first inserted element, or `dstPosition` if empty

== Parameters

[cols="1,4"]
|===
| Name| Description
| *dstPosition*
| location before which the element is inserted
| *value*
| element to move&hyphen;insert
| *values*
| initializer list of values to insert
| *numElements*
| number of copies of `value` to insert
| *first*
| start of the iterator range
| *last*
| one past the end of the iterator range
|===


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