57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
[flat.multiset.erasure]
|
||
|
||
# 23 Containers library [[containers]](./#containers)
|
||
|
||
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#flat.multiset.erasure)
|
||
|
||
### 23.6.12 Class template flat_multiset [[flat.multiset]](flat.multiset#erasure)
|
||
|
||
#### 23.6.12.6 Erasure [flat.multiset.erasure]
|
||
|
||
[ð](#lib:erase_if,flat_multiset)
|
||
|
||
`template<class Key, class Compare, class KeyContainer, class Predicate>
|
||
constexpr typename flat_multiset<Key, Compare, KeyContainer>::size_type
|
||
erase_if(flat_multiset<Key, Compare, KeyContainer>& c, Predicate pred);
|
||
`
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20071)
|
||
|
||
*Preconditions*: Key meets the *Cpp17MoveAssignable* requirements[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20075)
|
||
|
||
*Effects*: Let E be bool(pred(as_const(e)))[.](#2.sentence-1)
|
||
|
||
Erases all elements e in c for which E holds[.](#2.sentence-2)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20080)
|
||
|
||
*Returns*: The number of elements erased[.](#3.sentence-1)
|
||
|
||
[4](#4)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20084)
|
||
|
||
*Complexity*: Exactly c.size() applications of the predicate[.](#4.sentence-1)
|
||
|
||
[5](#5)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L20088)
|
||
|
||
*Remarks*: Stable ([[algorithm.stable]](algorithm.stable "16.4.6.8 Requirements for stable algorithms"))[.](#5.sentence-1)
|
||
|
||
If an invocation of erase_if exits via an exception,c is in a valid but unspecified state ([[defns.valid]](defns.valid "3.67 valid but unspecified state"))[.](#5.sentence-2)
|
||
|
||
[*Note [1](#note-1)*:
|
||
|
||
c still meets its invariants, but can be empty[.](#5.sentence-3)
|
||
|
||
â *end note*]
|