11.7. Removing Algorithms

The following algorithms remove elements from a range according to their value or to a criterion. These algorithms, however, cannot change the number of elements. The algorithms move logically only by overwriting “removed” elements with the following elements that were not removed. They return the new logical end of the range (the position after the last element not removed). See Section 6.7.1, page 218, for details.

11.7.1. Removing Certain Values

Removing Elements in a Sequence

ForwardIteratorremove (ForwardIterator beg, ForwardIterator end,        const T& value)ForwardIteratorremove_if (ForwardIterator beg, ForwardIterator end,          UnaryPredicate op)

remove() removes each element ...

Get C++ Standard Library, The: A Tutorial and Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.