[#BloombergLP-bslalg-ArrayPrimitives-destructiveMoveAndInsert-07]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::destructiveMoveAndInsert
:relfileprefix: ../../../
:mrdocs:

Move the elements of the parameterized `TARGET&lowbar;TYPE` in the array starting at the specified `fromBegin` address and ending immediately before the specified `fromEnd` address into an uninitialized array of `TARGET&lowbar;TYPE` at the specified `toBegin` address, inserting at the specified `position` (after translating from `fromBegin` to `toBegin`) the specified `numElements` copies of the non&hyphen;modifiable elements from the range starting at the specified `first` iterator of the parameterized `FWD&lowbar;ITER` type and ending immediately before the specified `last` sentinel or iterator&period; Keep the pointer at the specified `fromEndPtr` to point to the first uninitialized element in `&lsqb;fromBegin, fromEnd)&rsqb;` as the elements are moved from source to destination&period; The behavior is undefined unless `fromBegin &lt;&equals; position &lt;&equals; fromEnd`, the destination array contains at least `(fromEnd &hyphen; fromBegin) &plus; numElements` uninitialized elements after `toBegin`, and `numElements` is the distance from `first` to `last`&period; If a copy constructor or assignment operator for `TARGET&lowbar;TYPE` throws an exception, then any elements created in the output array are destroyed and the elements in the range `&lsqb; fromBegin, &ast;fromEndPtr )&rsqb;` will have unspecified but valid values&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TARGET&lowbar;TYPE,
    class FWD&lowbar;ITER,
    class SENTINEL&gt;
static
void
destructiveMoveAndInsert(
    TARGET&lowbar;TYPE* toBegin,
    TARGET&lowbar;TYPE** fromEndPtr,
    TARGET&lowbar;TYPE* fromBegin,
    TARGET&lowbar;TYPE* position,
    TARGET&lowbar;TYPE* fromEnd,
    FWD&lowbar;ITER first,
    SENTINEL last,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator);
----


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