Is there any specific reason for not having std::copy_if algorithm in C++ ? I know I can use std::remove_copy_if to achieve the required behavior. I think it is coming in C++0x, but a simple copy_if which takes a range, a output iterator and a functor would have been nice. Was it just simply missed out or is there some other reason behind it?
Stroustrup says they forgot it. It's in C++11.
However, you can use remove_copy_if
(which really should be called copy_if_not
) along with not1
instead.