Daily bit(e) of C++ | std::remove, std::remove_if
Daily bit(e) of C++ #213, The range compacting algorithms: std::remove and std::remove_if.
The std::remove and std::remove_if compact a range so that the leading sub-range [begin, last) does not contain any elements that match the provided value or for which the provided predicate evaluates to true.
The number of elements in the underlying range is unaffected, the non-removed elements maintain their relative order, and the subrange [last, end) contains elements in a moved-from state.