相关疑难解决方法(0)

为什么std :: string :: append()的功能不如std :: string :: operator +()?

我注意到了

std::string str;
str += 'b'; // works
str.append('b'); // does not work
str.append(1, 'b'); // works, but not as nice as the previous
Run Code Online (Sandbox Code Playgroud)

是否有任何理由说明该append方法不支持附加单个字符?我假设它operator+=实际上是该append方法的包装器,但似乎并非如此.

c++ string stl

11
推荐指数
2
解决办法
894
查看次数

标签 统计

c++ ×1

stl ×1

string ×1