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

Insert the specified `value` into the array of `allocator&lowbar;traits&lt;ALLOCATOR&gt;&colon;&colon;value&lowbar;type` objects at the specified `toBegin` location, shifting forward the elements from `toBegin` to the specified `toEnd` location by one position&period; `value` is left in a valid but unspecified state&period; If a (copy or move) constructor or a (copy or move) assignment operator throws an exception, then any elements created after `toEnd` are destroyed and the elements in the range `&lsqb;toBegin &period;&period; toEnd )&rsqb;` are left in a valid but unspecified state&period; The behavior is undefined unless `toBegin` refers to sufficient space to hold at least `toEnd &hyphen; toBegin &plus; 1` 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
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]#Created with https://www.mrdocs.com[MrDocs]#
