Remove Elements and Ranges

Apart from insertion, copying and replacement, we can also delete elements completely.

The four variations std::remove, std::remove_if, std::remove_copy and std::remove_copy_if support two kinds of operations. On one hand, remove elements with and without a predicate from a range. On the other hand, copy the result of your modification to a new range.

remove: Removes the elements from the range, having the value val:

Get hands-on with 1200+ tech skills courses.