it fixes the issue The obvious is when you want the old value returned, you use post-increment. The more subtle things are that pre-increment should really never be slower and could be faster due to the lack of creating a temporary and returning the old value when using post-increment.
set<int>::iterator it = set.begin();
// Post-increment so the value returned to erase is that of the previous
// iteration (i.e. begin()), yet the iterator stays valid due to the local
// iterator being incremented prior to the erase call
// Still valid iterator can be used.
cout << "Value: " << *it << "\n";
Does that help You're experiencing undefined behavior, by having multiple expressions with side-effects, without sequence points inbetween. There's no guarantee in which order function arguments are evaluated, so there's no way to "expect" something here (unless you wrote the compiler).
What is the difference between variable post-increment/decrement and pre-increment/decrement in bash?
wish helps you The order of evaluation of function parameters is not guaranteed in C. It might be left to right, or it might be right to left. It's up to the compiler implementation. It is undefined behaviour to have multiple references to a variable in combination with increment or decrement operators in one expression.
Confused about the increment and decrement operators in c or c++. What is the actual logic behind pre-increment or pre-d