Files
cppdraft_translate/cppdraft/vector/erasure.md
2025-10-25 03:02:53 +03:00

1.1 KiB

[vector.erasure]

23 Containers library [containers]

23.3 Sequence containers [sequences]

23.3.13 Class template vector [vector]

23.3.13.6 Erasure [vector.erasure]

🔗

template<class T, class Allocator, class U = T> constexpr typename vector<T, Allocator>::size_type erase(vector<T, Allocator>& c, const U& value);

1

#

Effects: Equivalent to:auto it = remove(c.begin(), c.end(), value);auto r = distance(it, c.end()); c.erase(it, c.end());return r;

🔗

template<class T, class Allocator, class Predicate> constexpr typename vector<T, Allocator>::size_type erase_if(vector<T, Allocator>& c, Predicate pred);

2

#

Effects: Equivalent to:auto it = remove_if(c.begin(), c.end(), pred);auto r = distance(it, c.end()); c.erase(it, c.end());return r;