#include #include #include #include //for back_inserter and ostream_iterator #include //for not1 #include //for remove_copy_if using namespace std; int main() { const int a[] = {10, 30, 40, 20, 50}; //need not be sorted for remove_copy_if const size_t n = sizeof a / sizeof a[0]; vector v; remove_copy_if(a, a + n, back_inserter(v), bind2nd(greater(), 30)); copy(v.begin(), v.end(), ostream_iterator(cout, "\n")); cout << "\n"; remove_copy_if( a, a + n, ostream_iterator(cout, "\n"), bind2nd(greater(), 30) ); return EXIT_SUCCESS; }