Skip to content

Glossary: C++ Beyond the Basics

std::erase_if

Also written: erase_if, erase-remove idiom

A C++20 function that removes every element matching a test and returns how many it removed. It replaces the older `std::remove_if` plus `erase` pattern.

Where the book teaches it

Related terms

AlgorithmLambda