Both i
and j
are glvalues (see this value category reference for details).
Then if you read this conditional operator reference we come to this point:
4) If E2 and E3 are glvalues of the same type and the same value category, then the result has the same type and value category
So the result of (i < 3) ? i : j
is a glvalue, which can be assigned to.
However doing something like that is really not something I would recommend.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…