Remove the std::remove_if code, and replaced with a helper function, such that
the remove_if syntax, i.e. the erase-remove idiom, is in a single spot.