[#bsl-vector-00d-insert-06b7]
= xref:bsl.adoc[bsl]::xref:bsl/vector-00d.adoc[vector]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

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

Insert a move&hyphen;inserted `value` before `position`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/iterator.adoc[vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/vector-00d/insert-05.adoc[insert](
    xref:bsl/vector-00d/const_iterator.adoc[const&lowbar;iterator] position,
    xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;VALUE&lowbar;TYPE&gt;] value);
----

[.small]#xref:bsl/vector-00d/insert-05.adoc[_» more&period;&period;&period;_]#

Insert the elements of `values` before `position`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/iterator.adoc[vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/vector-00d/insert-06ba.adoc[insert](
    xref:bsl/vector-00d/const_iterator.adoc[const&lowbar;iterator] position,
    std::initializer&lowbar;list&lt;VALUE&lowbar;TYPE&gt; values);
----

[.small]#xref:bsl/vector-00d/insert-06ba.adoc[_» more&period;&period;&period;_]#

Insert a copy of `value` at `position`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/iterator.adoc[vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/vector-00d/insert-09.adoc[insert](
    xref:bsl/vector-00d/const_iterator.adoc[const&lowbar;iterator] position,
    VALUE&lowbar;TYPE const& value);
----

[.small]#xref:bsl/vector-00d/insert-09.adoc[_» more&period;&period;&period;_]#

Insert elements into this vector&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/vector-00d/iterator.adoc[vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/vector-00d/insert-01.adoc[insert](
    xref:bsl/vector-00d/const_iterator.adoc[const&lowbar;iterator] position,
    xref:bsl/vector-00d/size_type.adoc[size&lowbar;type] numElements,
    VALUE&lowbar;TYPE const& value);
----

[.small]#xref:bsl/vector-00d/insert-01.adoc[_» more&period;&period;&period;_]#

Insert the range `&lsqb;first, last)&rsqb;` before `position`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class INPUT&lowbar;ITER&gt;
xref:bsl/vector-00d/iterator.adoc[iterator]
xref:bsl/vector-00d/insert-06bc.adoc[insert](
    xref:bsl/vector-00d/const_iterator.adoc[const&lowbar;iterator] position,
    INPUT&lowbar;ITER first,
    INPUT&lowbar;ITER last);
----

[.small]#xref:bsl/vector-00d/insert-06bc.adoc[_» more&period;&period;&period;_]#

== Return Value

* iterator referring to the newly inserted element
* iterator to the first inserted element, or `position` if empty
* iterator referring to the first newly inserted element, or `position` if none

== Parameters

[cols="1,4"]
|===
| Name| Description
| *position*
| iterator before which to insert
| *value*
| element to move&hyphen;insert
| *values*
| initializer list of values to insert
| *numElements*
| number of elements to insert or assign
| *first*
| start of the range to insert
| *last*
| end of the range to insert
|===


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