At the same time, itβs not very difficult to make your own copy_if() using remove_copy_if() :
#include <functional> struct my_predicate : std::unary_function<my_arg_type, bool> { bool operator()(my_arg_type const& x) const { ... } }; // To perform "copy_if(x, y, z, my_predicate())", write: remove_copy_if(x, y, z, std::not1(my_predicate()));
Using not1() requires your predicate class to provide a nested type, argument_type , identifying the type of argument β as shown above, one convenient way to do this is to infer from unary_function<T, U> , where T is the type of the argument.
j_random_hacker Apr 28 '09 at 10:24 2009-04-28 10:24
source share