Files
2025-10-25 03:02:53 +03:00

57 lines
1.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.8Requirements 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.67valid but unspecified state"))[.](#5.sentence-2)
[*Note [1](#note-1)*:
c still meets its invariants, but can be empty[.](#5.sentence-3)
— *end note*]