replace_copy

replace_copy

template<class InIt, class OutIt, class T>
    OutIt replace_copy(InIt first, InIt last, OutIt x,
        const T& vold, const T& vnew);

The template function executes the statement:

if (*(first + N) == vold)
    *(x + N) = vnew;
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.