[#BloombergLP-bslalg-ArrayPrimitives-erase-05]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/ArrayPrimitives.adoc[ArrayPrimitives]::erase
:relfileprefix: ../../../
:mrdocs:

Erase a range of elements and close the gap by moving&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TARGET&lowbar;TYPE&gt;
static
void
erase(
    TARGET&lowbar;TYPE* first,
    TARGET&lowbar;TYPE* middle,
    TARGET&lowbar;TYPE* last,
    xref:BloombergLP/bslma/Allocator.adoc[bslma::Allocator]* allocator = 0);
----

== Description

Destroy the elements of the parameterized `TARGET&lowbar;TYPE` in the array starting at the specified `first` address and ending immediately before the specified `middle` address, and move the elements in the array starting at `middle` and ending at the specified `last` address down to the `first` address&period; If an assignment throws an exception during this process, all of the elements in the range `&lsqb; first, last )&rsqb;` will have unspecified but valid values, and no elements are destroyed&period; The behavior is undefined unless `first &lt;&equals; middle &lt;&equals; last`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *first*
| beginning of the range to erase
| *middle*
| end of the range to erase (one past the last)
| *last*
| end of the populated array range
| *allocator*
| allocator used to destroy elements
|===


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