[vector.erasure] (original) (raw)

22 Containers library [containers]

22.3 Sequence containers [sequences]

22.3.11 Class template vector [vector]

22.3.11.6 Erasure [vector.erasure]

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

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);

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;