Standard C++ Library Reference ISO/IEC (VERSION3)
remove_if
template<class FwdIt, class Pr>
FwdIt remove_if(FwdIt first, FwdIt last, Pr pred);
The template function effectively assigns first to X, then executes the statement:
if (!pred(*(first + N)))
*X++ = *(first + N);
once for each N in the range [0, last - first). It then returns X. Thus, the function
removes from the resulting sequence all elements for which the predicate pred(*(first +
N)) is true, without altering the relative order of remaining elements, and returns the iterator
value that designates the end of the resulting sequence.
replace
template<class FwdIt, class Ty>
void replace(FwdIt first, FwdIt last,
const Ty& oldval, const Ty& newval);
The template function executes the statement:
if (*(first + N) == oldval)
*(first + N) = newval;
once for each N in the range [0, last - first). Here, operator== must perform a
pairwise comparison between its operands.
replace_copy
template<class InIt, class OutIt, class Ty>
OutIt replace_copy(InIt first, InIt last, OutIt dest,
const Ty& oldval, const Ty& newval);
The template function executes the statement:
if (*(first + N) == oldval)
*(dest + N) = newval;
else
*(dest + N) = *(first + N)
once for each N in the range [0, last - first). Here, operator== must perform a
pairwise comparison between its operands. The function returns the iterator value that designates
the end of the resulting sequence.
If dest and first designate regions of storage, the range [dest, dest + (last -
first)) must not overlap the range [first, last).