replace

template<caass FwdIt, class T>
    void replace(FwdIt first, FwdIt last,
        const T& vold, const T& vnew);

The template function executes the statement:

if (*(first + N) == vold)
    *(first + N) = vnew;

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

See the related sample program.