replace_copy_if

replace_copy_if

template<class InIt, class OutIt, class Pred, class T>
    OutIt replace_copy_if(InIt first, InIt last, OutIt x,
        Pred pr, const T& val);

The template function executes the statement:

if (pr(*(first + N)))
    *(x + N) = val;
else
    *(x + N) = *(first + N)

once for each N in the range [0, last - first).

If x and first designate regions of storage, the range [x, x + (last - first)) must not overlap the range [first, last).

See the related sample program.