假设我有以下代码:
void test(std::vector<int>& my_ints) {
for (auto& my_int : my_ints) {
if (my_int == 5 && /* not the last value in the vector */) {
my_int += /* next value in the vector */;
}
}
}
是否有任何有效的语法来替换注释?
PS!是的,我知道,使用常规for循环很容易,但是我想看看是否可以使用范围for循环来处理这种类型的内容。