Can I write
bool v1, v2;
// ...
EDIT: I am very sorry for the confusions. The correct statement should be:
bool v3 = !v1 ? v2 : !v2;
ORIGINAL I asked for
bool v3 = v1 ? v2 : !v2;
even shorter? Or: Is there an operator which will have the same result?
So I marked Anders Abels answer as correct, because he answered my initial question. I only need to invert his answer.
You can use
xor(the^operator) which will givetrueif one and only one of the operands istrue. It will return the opposite of what you want, so you have to negate everything: