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 predicate evaluates to true.
The number of elements in the range is unaffected, the non-removed elements maintain their relative order, and the subrange [last, end) may contain elements in a moved-from state.
Compiler Explorer link: https://compiler-explorer.com/z/65zoKv7c1