replace(start,done,oldvalue,newvalue)
replace(start,done,new,oldvalue,newvalue)
There are functions that take function objects, either unary or binary,
and process the elements depending on the result of the functions.
They are expected to return a Boolean and to not change the arguments.
The function objects, also called predicates since they return true or false,
take arguments that are of the base type.
So if the function call is
replace_if(start,done,pred,newvalue)
Then, the predicate pred() is called for each element using a
dereferenced iterator.
Somewhere in the code for replace_if(), there is a loop
over the iterator range using an iterator variable i;
The function object is called like this
pred(*i)
There are a large number of algorithms that fall into a number of general categories. There are minimum/maximum functions, numeric algorithms, sequence operators that don't change their arguments like for_each(), operators that change their arguments like copy(), sorting and searching functions, set operations on sorted containers operators that manipulate containers like heaps, lexicographical compare functions and permutation generators.