By Victor Ciura
Most seasoned C++ developers are familiar with the erase-remove(_if) idiom when using STL. The std::remove(_if) algorithm is a showcase of the beauty of STL generic design and the power of algorithmic composition through iterators.
Yet this seemingly trivial task of removing elements from a collection (based on a predicate) is an epitome of C++ footguns. And no modern compiler or static analysis can warn you about it. We are on our own. Ask me how I know…
Fear not, C++20 has a better alternative for us and it’s 100% safe and much leaner to use.