Daily bit(e) of C++ | std::erase, std::erase_if
Daily bit(e) of C++ #215, The C++20 container specific overload set for erasing elements by value or by predicate: std::erase and std::erase_if.
Before C++20, erasing elements from most containers based on their value or a predicate was a two-step process.
C++20 added a set of container-specific function overloads of std::erase and std::erase_if. These functions simplify the two-step process into a single call and (for the value version) support heterogeneous comparisons.