From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-04-11 16:55:12
Aleksey Gurtovoy wrote:
>> // custom user-defined macros:
>> #define _COMPARE_Aleksey(x) x
>> #define _COMPARE_Paul(x) x
>> _COMPARE(abc, Aleksey) // 0
>> _COMPARE(Paul, Aleksey) // 0
>> _COMPARE(Aleksey, abc) // 0
>> _COMPARE(Aleksey, Aleksey) // 1
> That's exactly the facility I would be completely happy with!
Notice the cool manipulation involved:
#define A(x) x
#define B(x) x
A( B )( () ) // expands to: ()
B( A )( () ) // expands to: ()
A( A )( () ) // expands to: A( () )
B( B )( () ) // expands to: B( () )
This is fundamental idiom at work here.
> Can we make it work for some of the broken preprocessors? Personally,
> I care only about MSVC and Metrowerks.
Actually it might be possible for those two, which are "evil" in general.
However, it won't work in many cases on preprocessor's that use the Borland
configuration, because they have trouble with the IS_NULLARY detection.
If you want, try it out "as is". All those facilities are already in the CVS
pp-lib. BOOST_PP_IS_NULLARY is present in
<boost/preprocessor/detail/is_nullary.hpp>, and is not technically an interface
macro (because I can't make it work, in general, with the Borland config).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk