[#bsl-multiset-03-erase-05]
= xref:bsl.adoc[bsl]::xref:bsl/multiset-03.adoc[multiset]::erase
:relfileprefix: ../../
:mrdocs:

Erase all elements equivalent to `key`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/multiset-03/size_type.adoc[multiset&lt;KEY, COMPARATOR, ALLOCATOR&gt;::size&lowbar;type]
erase(xref:bsl/multiset-03/key_type.adoc[key&lowbar;type] const& key);
----

== Description

Remove from this multiset all `value&lowbar;type` objects equivalent to the specified `key`, if they exist, and return the number of erased objects&semi; otherwise, if there are no `value&lowbar;type` objects 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&period;

== Return Value

number of elements erased

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| key whose matching elements are erased
|===


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