6

It is my understanding that the term j = i will be executed before ++i in the statement

j = i, ++i;.

Does the C++ standard guarantee that j = i will be executed before ++i in the loop

for (auto i = std::next(begin), j = begin; i!= end; j= i, ++i)?

Catriel
  • 461
  • 3
  • 11

1 Answers1

10

The comma operator introduces a sequence point and, as such, this behavior is guaranteed by the C++ standard.

Sam Varshavchik
  • 114,536
  • 5
  • 94
  • 148