I am puzzled by the following:
bool a = true;
int nb = 1;
int nb2 = 2;
a ? nb++, nb2++ : nb--, nb2--;
std::cout << " (nb,nb2) = (" << nb << "," << nb2 << ")";
(nb,nb2) = (2,2)
Because of operators priority. Your expression evaluates as
((a) ? (nb++, nb2++) : nb--), nb2--;
comma) is the last thing to process. And this example would not compile at all but
The expression in the middle of the conditional operator (between ? and :) is parsed as if parenthesized.
See C++ Operator Precedence for details.