[#BloombergLP-bslalg-DequePrimitives-01-insertAndMoveToBack-09]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/DequePrimitives-01.adoc[DequePrimitives]::insertAndMoveToBack
:relfileprefix: ../../../
:mrdocs:

Insert a source range, shifting existing elements toward the back&period;

== Synopsis

Declared in `&lt;bslalg&lowbar;dequeprimitives&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class FWD&lowbar;ITER,
    class SENTINEL,
    class ALLOCATOR&gt;
static
void
insertAndMoveToBack(
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toEnd,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromEnd,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] position,
    FWD&lowbar;ITER first,
    SENTINEL last,
    xref:BloombergLP/bslalg/DequePrimitives-01/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----

== Description

Insert the specified `numElements` in the range `&lsqb;first &period;&period; last)&rsqb;` at the specified `position`, by moving the elements in the range `&lsqb;position &period;&period; fromEnd)&rsqb;` forward by `numElements` position&period; Pass the specified `allocator` to the copy constructor if appropriate&period; Load into the specified `toEnd` an iterator to the end of the data after insertion (i&period;e&period;, `fromEnd &plus; numElements`)&period; The behavior is undefined unless `fromEnd &plus; numElements` is a valid iterator (i&period;e&period;, the block pointer array holds enough room after the `fromEnd` position to insert `numElements`)&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *toEnd*
| loads the end iterator after insertion
| *fromEnd*
| current end of the deque
| *position*
| insertion position within the deque
| *first*
| beginning of the source range to insert
| *last*
| end of the source range to insert (one past the last)
| *numElements*
| number of elements in `&lsqb;first &period;&period; last)&rsqb;`
| *allocator*
| allocator passed to element constructors
|===


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