Hello all, small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)? Scenario: I have 2 data members used in variant like way: only 1 may be valid. Both valid or both invalid is incorrect.
AMDG gast128 wrote:
small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)?
Huh? The xor operator is ^.
Scenario: I have 2 data members used in variant like way: only 1 may be valid. Both valid or both invalid is incorrect.
I don't understand the connection. In Christ, Steven Watanabe
Steven Watanabe
gast128 wrote:
small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)?
Huh? The xor operator is ^.
Isn't that the bitwise exclusive xor operator? Reading now my mail back I forget to specify the 'logical xor' term.
2010/8/12 gast128
Hello all,
small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)?
Scenario: I have 2 data members used in variant like way: only 1 may be valid. Both valid or both invalid is incorrect.
Can't you use !!A != !!B? (or !!A ^ !!B) -- Murilo Adriano Vasconcelos http://murilo.wordpress.com
Hello all, small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)? Scenario: I have 2 data members used in variant like way: only 1 may be valid. Both valid or both invalid is incorrect.
Can't you use !!A != !!B? (or !!A ^ !!B)
ah quite brilliant! I was thinking about the (a ? !b : b). Still a logical_xor does also has a documentation value.
2010/8/12 gast128
Hello all, small question: there seems no xor operator in c++ but there is also no Boost xor functor (like the std::logical_and)? Scenario: I have 2 data members used in variant like way: only 1 may be valid. Both valid or both invalid is incorrect.
Can't you use !!A != !!B? (or !!A ^ !!B)
ah quite brilliant! I was thinking about the (a ? !b : b). Still a logical_xor does also has a documentation value.
operator^ works fine for booleans, and I guess that's what you want to apply logical_xor to. bool a, b; bool c = a ^ b; // Fine. Roman Perepelitsa.
participants (5)
-
Eric J. Holtman
-
gast128
-
Murilo Adriano Vasconcelos
-
Roman Perepelitsa
-
Steven Watanabe