我尝试使用std::replace算法:
replace(out.begin(), out.end(), '\r', '\r\n'); // error
replace(out.begin(), out.end(), "\r", "\r\n"); // error
replace(out.begin(), out.end(), "\\r", "\\r\\n"); // error
我总是收到参数不明确的错误。我怎样才能指定\r,\n所以编译器不会抱怨?
编辑:
错误:
could not deduce template argument for 'const _Ty &' from 'const char [5]'
template parameter '_Ty' is ambiguous
'replace': no matching overloaded function found