[#BloombergLP-bslalg-ArrayPrimitives-moveInsert-00]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::moveInsert
:relfileprefix: ../../../
:mrdocs:

Move&hyphen;insert a source range, shifting subsequent elements&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
void
moveInsert(
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toBegin,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toEnd,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer* fromEndPtr,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer fromBegin,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer fromEnd,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----

== Description

Move the elements of type given by the `allocator&lowbar;traits` class template for (template parameter) `ALLOCATOR` in the array starting at the specified `toBegin` location and ending immediately before the specified `toEnd` location by the specified `numElements` positions towards larger addresses, and fill the `numElements` at the `toBegin` location by moving the elements from the array starting at the specified `fromBegin` and ending immediately before the specified `fromEnd` location&period; Keep the iterator at the specified `fromEndPtr` address pointing to the end of the range as the elements from `&lsqb; fromBegin, fromEnd )&rsqb;` are moved from source to destination&period; The behavior is undefined unless the destination array contains `numElements` uninitialized elements after `toEnd`, `numElements` is the distance from `fromBegin` to `fromEnd`, and the input and destination arrays do not overlap&period; If a copy constructor or assignment operator for `TARGET&lowbar;TYPE` throws an exception, then any elements created after `toEnd` are destroyed, the elements in the ranges `&lsqb; toBegin, toEnd)&rsqb;` and `&lsqb; fromBegin, &ast;fromEndPtr )&rsqb;` will have unspecified, but valid, values, and the elements in `&lsqb; &ast;fromEndPtr, fromEnd )&rsqb;` will be destroyed&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *toBegin*
| insertion position within the destination array
| *toEnd*
| end of the populated destination range
| *fromEndPtr*
| loads the end of the remaining valid source range
| *fromBegin*
| beginning of the source range to move&hyphen;insert
| *fromEnd*
| end of the source range to move&hyphen;insert
| *numElements*
| number of elements to move&hyphen;insert
| *allocator*
| allocator used to supply memory if required
|===


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