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

Move the elements of type `allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon;value&lowbar;type` in the range beginning at the specified `fromBegin` location and ending immediately before the specified `fromEnd` location into the uninitialized array beginning at the specified `toBegin` location using the specified `allocator` to supply memory (if required), 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 (template parameter) type `FWD&lowbar;ITER` and ending immediately before the specified `last` sentinel or iterator, ensuring that the specified `fromEndPtr` points to the first uninitialized element in `&lsqb;fromBegin &period;&period; fromEnd)&rsqb;` as the elements are moved from source to destination&period; On return, the elements in the input range are invalid, i&period;e&period;, their destructors must not be called after this operation returns&period; If a constructor throws an exception during this operation, the output array is left in an uninitialized state&period; If a constructor other than the copy or move constructor throws an exception during this operation, the input array is unaffected&semi; otherwise, if a copy or move constructor throws an exception during this operation, the input elements in the range `&lsqb;fromBegin &period;&period; &ast;fromEndPtr)&rsqb;` are left in a valid but unspecified state and the remaining portion of the input array is left in an uninitialized state&period; The behavior is undefined unless `fromBegin &lt;&equals; position &lt;&equals; fromEnd` and `toBegin` refers to space sufficient to hold `fromEnd &hyphen; fromBegin &plus; numElements` elements&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ALLOCATOR,
    class FWD&lowbar;ITER,
    class SENTINEL&gt;
static
void
destructiveMoveAndInsert(
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toBegin,
    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 position,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer fromEnd,
    FWD&lowbar;ITER first,
    SENTINEL last,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----


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