[#bsl-unordered_map-02b-erase-0a]
= xref:bsl.adoc[bsl]::xref:bsl/unordered_map-02b.adoc[unordered&lowbar;map]::erase
:relfileprefix: ../../
:mrdocs:

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

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class t&lowbar;KEY&gt;
xref:bsl/unordered_map-02b/size_type.adoc[size&lowbar;type]
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;
----

== Description

Remove from this unordered map the `value&lowbar;type` object having a key equivalent to the specified `key`, if it exists, and return 1&semi; otherwise return 0 with no other effect&period; This overload participates in overload resolution only when the hasher and comparator are transparent&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 to look up
|===


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