[#bsl-unordered_set-0d2d-erase-02]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_set-0d2d.adoc[unordered&lowbar;set]::erase
:relfileprefix: ../../
:mrdocs:

`erase` overloads

== Synopses

Declared in `&lt;bslstl&lowbar;unorderedset&period;h&gt;`

Erase the element at `position`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-0d2d/iterator.adoc[unordered&lowbar;set&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;::iterator]
xref:bsl/unordered_set-0d2d/erase-0b.adoc[erase](xref:bsl/unordered_set-0d2d/const_iterator.adoc[const&lowbar;iterator] position);
----

[.small]#xref:bsl/unordered_set-0d2d/erase-0b.adoc[_» more&period;&period;&period;_]#

Erase the element equivalent to `key`, if present&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-0d2d/size_type.adoc[unordered&lowbar;set&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;::size&lowbar;type]
xref:bsl/unordered_set-0d2d/erase-0e.adoc[erase](xref:bsl/unordered_set-0d2d/key_type.adoc[key&lowbar;type] const& key);
----

[.small]#xref:bsl/unordered_set-0d2d/erase-0e.adoc[_» more&period;&period;&period;_]#

Erase the element equivalent to `key`, if present&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;KEY&gt;
xref:bsl/unordered_set-0d2d/size_type.adoc[size&lowbar;type]
xref:bsl/unordered_set-0d2d/erase-083.adoc[erase](t&lowbar;KEY&& key)
requires BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;HASH, t&lowbar;KEY&gt;&colon;&colon;value &amp;&amp;
        BloombergLP&colon;&colon;bslmf&colon;&colon;IsTransparentPredicate&lt;EQUAL,t&lowbar;KEY&gt;&colon;&colon;value &amp;&amp;
        !is&lowbar;convertible&lt;BSLS&lowbar;COMPILERFEATURES&lowbar;FORWARD&lowbar;REF(t&lowbar;KEY),
                        iterator&gt;&colon;&colon;value &amp;&amp;
        !is&lowbar;convertible&lt;BSLS&lowbar;COMPILERFEATURES&lowbar;FORWARD&lowbar;REF(t&lowbar;KEY),
                        const&lowbar;iterator&gt;&colon;&colon;value;
----

[.small]#xref:bsl/unordered_set-0d2d/erase-083.adoc[_» more&period;&period;&period;_]#

Erase the elements in the half&hyphen;open range `&lsqb;first, last)&rsqb;`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/unordered_set-0d2d/iterator.adoc[unordered&lowbar;set&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;::iterator]
xref:bsl/unordered_set-0d2d/erase-080.adoc[erase](
    xref:bsl/unordered_set-0d2d/const_iterator.adoc[const&lowbar;iterator] first,
    xref:bsl/unordered_set-0d2d/const_iterator.adoc[const&lowbar;iterator] last);
----

[.small]#xref:bsl/unordered_set-0d2d/erase-080.adoc[_» more&period;&period;&period;_]#

== Return Value

* iterator following the erased element
* `1` if erased, otherwise `0`
* `last`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *position*
| iterator to the element to erase
| *key*
| key value to look up
| *first*
| beginning of the range
| *last*
| end of the range (one past last)
|===


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