#include #include #include #include #include #include struct is_even { bool operator()(int x) const { return x % 2 == 0; } }; int main(int argc, const char* argv[]) { using namespace boost::adaptors; using namespace boost::assign; std::vector input; input += 1,2,3,4,5,6,7,8,9; boost::copy( input | replaced_if(is_even(), 10), std::ostream_iterator(std::cout, ",")); return 0; }