int for list int iterator pos begin pos end pos auto val std next pos

1
2
3
4
5
6
7
8
int j = 0;
for (list<int>::iterator pos = v.begin(); pos != v.end(); ++pos) {
auto val = std::next(pos, 1);
if (*pos == x) {
pos_list.push_back(j);
}
++j;
}