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

`destructiveMoveAndInsert` overloads

== Synopses

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

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` objects initialized to default values, 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 default constructor throws an exception, 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 &apos;fromBegin &lt;&equals; position &lt;&equals; fromEnd&apos; and `toBegin` refers to space sufficient to hold `fromEnd &hyphen; fromBegin &plus; 1` elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-01.adoc[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,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----

[.small]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-01.adoc[_» more&period;&period;&period;_]#

Move the elements of the (template parameter) `TARGET&lowbar;TYPE` in the starting at the specified `fromBegin` address and ending immediately before the specified `fromEnd` address 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`) `numElements` objects initialized to default values, 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 default constructor throws an exception, 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;


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

[.small]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-06.adoc[_» more&period;&period;&period;_]#

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 specified `value`, 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 (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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-0c1.adoc[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,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::value&lowbar;type const& value,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----

[.small]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-0c1.adoc[_» more&period;&period;&period;_]#

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 specified `value`&period; Keep the pointer at the specified `fromEndPtr` address pointing to the first uninitialized element in &apos;&lsqb; fromBegin,&rsqb; fromEnd)&apos; as the elements are moved from source to destination&period; The behavior is undefined unless `fromBegin &lt;&equals; position &lt;&equals; fromEnd` and the destination array contains at least `(fromEnd &hyphen; fromBegin) &plus; numElements` uninitialized elements&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;


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

[.small]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-03.adoc[_» more&period;&period;&period;_]#

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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class ALLOCATOR,
    class FWD&lowbar;ITER,
    class SENTINEL&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-0c9.adoc[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]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-0c9.adoc[_» more&period;&period;&period;_]#

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;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TARGET&lowbar;TYPE,
    class FWD&lowbar;ITER,
    class SENTINEL&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-07.adoc[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]#xref:BloombergLP/bslalg/ArrayPrimitives/destructiveMoveAndInsert-07.adoc[_» more&period;&period;&period;_]#


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