[#BloombergLP-bslalg-DequePrimitives-01-erase-0c]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/DequePrimitives-01.adoc[DequePrimitives]::erase
:relfileprefix: ../../../
:mrdocs:

`erase` overloads

== Synopses

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

Erase a range of elements from a deque and close the gap&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[DequePrimitives&lt;VALUE&lowbar;TYPE, BLOCK&lowbar;LENGTH&gt;::Iterator]
xref:BloombergLP/bslalg/DequePrimitives-01/erase-0f.adoc[erase](
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toEnd,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] first,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] last,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromEnd,
    ALLOCATOR allocator);
----

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

Same as the preceding `erase` overload for bitwise&hyphen;copyable types&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[DequePrimitives&lt;VALUE&lowbar;TYPE, BLOCK&lowbar;LENGTH&gt;::Iterator]
xref:BloombergLP/bslalg/DequePrimitives-01/erase-05.adoc[erase](
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toEnd,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] first,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] last,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromEnd,
    ALLOCATOR allocator,
    xref:bsl/integral_constant-02.adoc[bsl::integral&lowbar;constant&lt;int, BSLALG&lowbar;DEQUEPRIMITIVES&lowbar;BITWISE&lowbar;COPYABLE&lowbar;TRAITS&gt;] traits);
----

[.small]#xref:BloombergLP/bslalg/DequePrimitives-01/erase-05.adoc[_» more&period;&period;&period;_]#

Erase a range of elements from a deque (nil traits)&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ALLOCATOR&gt;
static
xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[DequePrimitives&lt;VALUE&lowbar;TYPE, BLOCK&lowbar;LENGTH&gt;::Iterator]
xref:BloombergLP/bslalg/DequePrimitives-01/erase-08.adoc[erase](
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator]* toEnd,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromBegin,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] first,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] last,
    xref:BloombergLP/bslalg/DequePrimitives-01/Iterator.adoc[Iterator] fromEnd,
    ALLOCATOR allocator,
    xref:bsl/integral_constant-02.adoc[bsl::integral&lowbar;constant&lt;int, BSLALG&lowbar;DEQUEPRIMITIVES&lowbar;NIL&lowbar;TRAITS&gt;] traits);
----

[.small]#xref:BloombergLP/bslalg/DequePrimitives-01/erase-08.adoc[_» more&period;&period;&period;_]#

== Return Value

iterator to the element immediately following the removed elements

== Parameters

[cols="1,4"]
|===
| Name| Description
| *toBegin*
| loads the new beginning iterator of the deque
| *toEnd*
| loads the new end iterator of the deque
| *fromBegin*
| current beginning of the deque
| *first*
| beginning of the range to erase
| *last*
| end of the range to erase (one past the last)
| *fromEnd*
| current end of the deque
| *allocator*
| allocator used to destroy elements
| *traits*
| unused trait tag for overload resolution
|===


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