Why does concatenating to a string that's too long add the second string twice?

后端 未结 0 1845
梦谈多话
梦谈多话 2021-01-05 09:38

Why does this output "hello wor world!"?

string str("hello", 10);
str += " world!";
cout << str << endl;


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题