// Illustrating the generic replace algorithm #include #include #include #include #include using namespace std; int main() { cout << "Illustrating the generic replace algorithm." << endl; string s("FERRARI"); vector vector1(s.begin(), s.end()); // Replace all occurrences of R by S: replace(vector1.begin(), vector1.end(), 'R', 'S'); assert (string(vector1.begin(), vector1.end()) == string("FESSASI")); cout << " --- Ok." << endl; return 0; }