Modernize/simplify code
I think copy_if is easier to read than remove_copy_if.
(cherry picked from commit 382c2d3f32497424a7cc1652bd60cbe921d4d4f0)