5

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
  • 194
  • 8

1 Answers1

9

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

Sam Varshavchik
  • 98,597
  • 5
  • 74
  • 125