[#bsl-deque-0c-insert-07]
= xref:bsl.adoc[bsl]::xref:bsl/deque-0c.adoc[deque]::insert
:relfileprefix: ../../
:mrdocs:

`insert` overloads

== Synopses

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

Insert at the specified `position` in this deque the specified move&hyphen;insertable `value`, and return an iterator providing modifiable access to the newly inserted element&period; `value` is left in a valid but unspecified state&period; If an exception is thrown (other than by the copy constructor, move constructor, assignment operator, or move assignment operator of `value&lowbar;type`), this method has no effect&period; This method requires that the (template parameter) `VALUE&lowbar;TYPE` be `move&hyphen;insertable` into this deque (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` (both endpoints included)&period;


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

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

Insert at the specified `position` in this deque the value of each `value&lowbar;type` object in the specified `values` initializer list, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements&period; This method offers full guarantee of rollback in case an exception is thrown other than by the `VALUE&lowbar;TYPE` copy constructor or assignment operator&period; This method requires that the (template parameter) `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this deque (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` (both endpoints included)&period;


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

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

Insert at the specified `position` in this deque a copy of the specified `value`, and return an iterator providing modifiable access to the newly inserted element&period; This method offers full guarantee of rollback in case an exception is thrown other than by the `VALUE&lowbar;TYPE` copy constructor or assignment operator&period; This method requires that the (template parameter) `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this deque (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` (both endpoints included)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/deque-0c/iterator-02.adoc[deque&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/deque-0c/insert-08.adoc[insert](
    xref:bsl/deque-0c/const_iterator.adoc[const&lowbar;iterator] position,
    VALUE&lowbar;TYPE const& value);
----

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

Insert at the specified `position` in this deque the specified `numElements` copies of the specified `value`, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements&period; This method offers full guarantee of rollback in case an exception is thrown other than by the `VALUE&lowbar;TYPE` copy constructor or assignment operator&period; This method requires that the (template parameter) `VALUE&lowbar;TYPE` be `copy&hyphen;insertable` into this deque (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` (both endpoints included)&period;


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

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

Insert at the specified `position` in this deque the values in the range starting at the specified `first` and ending immediately before the specified `last` iterators of the (template parameter) type `INPUT&lowbar;ITERATOR`, and return an iterator providing modifiable access to the first element in the newly inserted sequence of elements&period; This method offers full guarantee of rollback in case an exception is thrown other than by the `VALUE&lowbar;TYPE` copy constructor or assignment operator&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;input&period;iterators&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 deque, where `i` is a dereferenceable iterator in the range `&lsqb;first &period;&period; last)&rsqb;` (see &lcub;Requirements on `VALUE&lowbar;TYPE`&rcub;)&period; The behavior is undefined unless `position` is an iterator in the range `&lsqb;cbegin() &period;&period; cend()&rsqb;` (both endpoints included), and `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;
xref:bsl/deque-0c/iterator-02.adoc[deque&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::iterator]
xref:bsl/deque-0c/insert-0f.adoc[insert](
    xref:bsl/deque-0c/const_iterator.adoc[const&lowbar;iterator] position,
    INPUT&lowbar;ITERATOR first,
    INPUT&lowbar;ITERATOR last);
----

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


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