If we need selectively copy elements from one range to another, the standard offers the std::copy_if
and std::remove_copy_if
algorithms.
Both algorithms accept a predicate, copying elements for which the predicate returns true and false respectively.
Click to open in Compiler Explorer.
Leave a comment