replace_if Like replace except a binary predicate is used instead of a value There is also replace_if_copy int main() { int a[ ] = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5}; replace_if(a, a + 10, bind2nd(less(), 3), 10); copy(a, a + 10, ostream_iterator(cout, " ")); }