I want to replace all occurrence of \'a\' with \'b\', and \'c\' with \'d\'.
My current solution is:
std::replace(str.begin(), str.end(), \'a\', \'b\'
If you do not like two passes, you can do it once:
std::transform(std::begin(s), std::end(s), std::begin(s), [](auto ch) { switch (ch) { case 'a': return 'b'; case 'c': return 'd'; } return ch; });