idiomatic way of changing container elements while iterating over the container

后端 未结 0 1121
野性不改
野性不改 2020-12-18 06:27

Is the following way of manipulating a string or a container idiomatic?

string s = "hello";
for (auto &p : s) {
    p = \'a\';
}
<
相关标签:
回答
  • 消灭零回复
提交回复
热议问题