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

`insert` overloads

== Synopses

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

Insert a movable value, shifting subsequent elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/insert-04.adoc[insert](
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toBegin,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toEnd,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::value&lowbar;type&gt;] value,
    ALLOCATOR allocator);
----

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

Insert a movable value, shifting subsequent elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TARGET&lowbar;TYPE&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/insert-0d.adoc[insert](
    TARGET&lowbar;TYPE* toBegin,
    TARGET&lowbar;TYPE* toEnd,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;TARGET&lowbar;TYPE&gt;] value,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator);
----

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

Insert copies of a value, shifting subsequent elements&period;


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

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

Insert copies of a value, shifting subsequent elements&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TARGET&lowbar;TYPE&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/insert-0ab.adoc[insert](
    TARGET&lowbar;TYPE* toBegin,
    TARGET&lowbar;TYPE* toEnd,
    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/insert-0ab.adoc[_» more&period;&period;&period;_]#

Same as the preceding `insert` overload, taking pointer iterators&period;


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

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

Same as the preceding overload, taking pointer iterators&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TARGET&lowbar;TYPE,
    class SOURCE&lowbar;TYPE&gt;
static
void
xref:BloombergLP/bslalg/ArrayPrimitives/insert-0c.adoc[insert](
    TARGET&lowbar;TYPE* toBegin,
    TARGET&lowbar;TYPE* toEnd,
    SOURCE&lowbar;TYPE* fromBegin,
    SOURCE&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/insert-0c.adoc[_» more&period;&period;&period;_]#

Insert a source range, shifting subsequent 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/insert-0f.adoc[insert](
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toBegin,
    bsl::allocator&lowbar;traits&lt;ALLOCATOR&gt;::pointer toEnd,
    FWD&lowbar;ITER fromBegin,
    SENTINEL fromEnd,
    xref:BloombergLP/bslalg/ArrayPrimitives/size_type.adoc[size&lowbar;type] numElements,
    ALLOCATOR allocator);
----

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

Insert a source range, shifting subsequent elements&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/insert-06.adoc[insert](
    TARGET&lowbar;TYPE* toBegin,
    TARGET&lowbar;TYPE* toEnd,
    FWD&lowbar;ITER fromBegin,
    SENTINEL 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/insert-06.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *toBegin*
| insertion position within the destination array
| *toEnd*
| end of the populated destination range
| *value*
| movable value to insert
| *allocator*
| allocator used to supply memory if required
| *numElements*
| number of copies of `value` to insert
| *fromBegin*
| beginning of the source range to insert
| *fromEnd*
| end of the source range to insert
|===


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