string 替换字符的问题、、求大神看看
int main(){
string s = "a tho b thru c tho";
string oldval = "tho";
string newval = "through";
auto curr = s.begin();
while (curr <= (s.end() - oldval.size()))
{
string s1(curr, curr + oldval.size());
if (s1 == oldval)
{
curr = s.replace(curr,oldval.size(),newval);******************这步一直报错,说参数有问题
curr += newval.size();
}
else curr++;
}cout << s << endl;
// hanshu(s, oldval, newval);
return 0;
}