I have a string which contains ` char and I want to replace it with escaped form of same char.
// Turns ` to \'
std::replace(script.begin(), script.end(), std::string("\\`"), std::string("\\\\`"));
However, the code won't compile,
error: invalid operands to binary expression ('char' and 'const std::basic_string<char>')
if (*__first == __old_value)
~~~~~~~~ ^ ~~~~~~~~~~~
note: in instantiation of function template specialization
'std::replace<std::__wrap_iter<char *>, std::basic_string<char>>' requested here
std::replace(script.begin(), script.end(), std::string("\\`"), std::string("\\\\`"));