O'Reilly logo

The C++ Standard Library: A Tutorial and Reference, Second Edition by Nicolai M. Josuttis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required