|
Boost : |
From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2003-08-21 06:21:29
Daniel Frey wrote:
> Paul Mensonides wrote:
>>> #define xor )?BOOST_DETAIL_XOR(
>>
>> FYI, you cannot legally define "xor" because it is specifically *not* an
>> identifier--even to the preprocessor. This is the primary difference
>> between "keywords" and textual "alternative tokens."
>
> I admit that I forgot that 'xor' is an alternative token (which should
> better be called bitxor, but anyway).
>
> But according to the Boost guidelines, my macro has to be called
> BOOST_XOR anyway ("boostification"). Or how about alternatives like
> 'eor', 'lxor', 'logicxor', you-name-it...?
>
Good idea :-)
I'd use 'BOOST_LXOR'.
I'd implement it as:
#define BOOST_DETAIL_LXOR(x) !(x) : !!(x)
which would work with classes without bool/safe_bool conversion but with operator!.
Fernando Cacciola
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk