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

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

== Synopsis

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

[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]
erase(xref:bsl/unordered_set-0d2d/key_type.adoc[key&lowbar;type] const& key);
----

== Description

Remove from this set the `value&lowbar;type` object that is equivalent to the specified `key`, if such an entry exists, and return 1&semi; otherwise, if there is no `value&lowbar;type` object that is equivalent to `key`, return 0 with no other effect&period; This method invalidates only iterators and references to the removed element and previously saved values of the `end()` iterator, and preserves the relative order of the elements not removed&period;

== Return Value

`1` if erased, otherwise `0`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| key value to look up
|===


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