[#bsl-erase_if-071]
= xref:bsl.adoc[bsl]::erase&lowbar;if
:relfileprefix: ../
:mrdocs:

`erase&lowbar;if` overloads

== Synopses

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

Erase every element of `deq` that satisfies `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE&lowbar;TYPE,
    class ALLOCATOR,
    class PREDICATE&gt;
deque&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0b.adoc[erase&lowbar;if](
    xref:bsl/deque-0c.adoc[deque&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;]& deq,
    PREDICATE predicate);
----

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

Erase all elements in `l` that satisfy the specified `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::list&lt;VALUE, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-076.adoc[erase&lowbar;if](
    xref:bsl/list-054.adoc[list&lt;VALUE, ALLOCATOR&gt;]& l,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-076.adoc[_» more&period;&period;&period;_]#

Erase all the elements in the specified vector `vec` that satisfy the specified predicate `predicate`&period; Return the number of elements erased&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE&lowbar;TYPE,
    class ALLOCATOR,
    class PREDICATE&gt;
vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-03a.adoc[erase&lowbar;if](
    xref:bsl/vector-00d.adoc[vector&lt;VALUE&lowbar;TYPE, ALLOCATOR&gt;]& vec,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-03a.adoc[_» more&period;&period;&period;_]#

Erase all characters matching a predicate from a string&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class CHAR&lowbar;TYPE,
    class CHAR&lowbar;TRAITS,
    class ALLOCATOR,
    class UNARY&lowbar;PREDICATE&gt;
bsl::basic&lowbar;string&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0e.adoc[erase&lowbar;if](
    xref:bsl/basic_string-0faf.adoc[basic&lowbar;string&lt;CHAR&lowbar;TYPE, CHAR&lowbar;TRAITS, ALLOCATOR&gt;]& str,
    UNARY&lowbar;PREDICATE const& pred);
----

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

Erase all elements in `ms` that satisfy `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::multiset&lt;KEY, COMPARATOR, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-030.adoc[erase&lowbar;if](
    xref:bsl/multiset-03.adoc[multiset&lt;KEY, COMPARATOR, ALLOCATOR&gt;]& ms,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-030.adoc[_» more&period;&period;&period;_]#

Erase all elements in `s` that satisfy `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::set&lt;KEY, COMPARATOR, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-04.adoc[erase&lowbar;if](
    xref:bsl/set-0d.adoc[set&lt;KEY, COMPARATOR, ALLOCATOR&gt;]& s,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-04.adoc[_» more&period;&period;&period;_]#

Erase every element of `m` that satisfies `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-01.adoc[erase&lowbar;if](
    xref:bsl/map-0a7.adoc[map&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;]& m,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-01.adoc[_» more&period;&period;&period;_]#

Erase every element of `m` that satisfies `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class COMPARATOR,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::multimap&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0f.adoc[erase&lowbar;if](
    xref:bsl/multimap-0ae.adoc[multimap&lt;KEY, VALUE, COMPARATOR, ALLOCATOR&gt;]& m,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-0f.adoc[_» more&period;&period;&period;_]#

Erase all elements in `ms` that satisfy `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::unordered&lowbar;multiset&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-074.adoc[erase&lowbar;if](
    xref:bsl/unordered_multiset-06c.adoc[unordered&lowbar;multiset&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;]& ms,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-074.adoc[_» more&period;&period;&period;_]#

Erase elements from `s` that satisfy `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::unordered&lowbar;set&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0d.adoc[erase&lowbar;if](
    xref:bsl/unordered_set-0d2d.adoc[unordered&lowbar;set&lt;KEY, HASH, EQUAL, ALLOCATOR&gt;]& s,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-0d.adoc[_» more&period;&period;&period;_]#

Erase every element of `m` that satisfies `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::unordered&lowbar;map&lt;KEY, VALUE, HASH, EQUAL, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0a4.adoc[erase&lowbar;if](
    xref:bsl/unordered_map-02b.adoc[unordered&lowbar;map&lt;KEY, VALUE, HASH, EQUAL, ALLOCATOR&gt;]& m,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-0a4.adoc[_» more&period;&period;&period;_]#

Erase every element of `m` that satisfies `predicate`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class KEY,
    class VALUE,
    class HASH,
    class EQUAL,
    class ALLOCATOR,
    class PREDICATE&gt;
bsl::unordered&lowbar;multimap&lt;KEY, VALUE, HASH, EQUAL, ALLOCATOR&gt;::size&lowbar;type
xref:bsl/erase_if-0aa.adoc[erase&lowbar;if](
    xref:bsl/unordered_multimap-0b0.adoc[unordered&lowbar;multimap&lt;KEY, VALUE, HASH, EQUAL, ALLOCATOR&gt;]& m,
    PREDICATE predicate);
----

[.small]#xref:bsl/erase_if-0aa.adoc[_» more&period;&period;&period;_]#

== Return Value

* number of elements erased
* number of characters erased

== Parameters

[cols="1,4"]
|===
| Name| Description
| *deq*
| deque from which matching elements are erased
| *predicate*
| unary predicate selecting elements to erase
| *l*
| list from which to erase elements
| *vec*
| vector to modify
| *str*
| string to modify
| *pred*
| unary predicate selecting characters to erase
| *ms*
| multiset from which to erase elements
| *s*
| set from which to erase elements
| *m*
| map from which matching elements are erased
|===


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