Boost logo

Boost Users :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2007-06-16 07:18:43


Server Levent Yilmaz wrote:
> I did somehow come up with this dirty trick, though it doesn't quite cut it:
>

<snip code>

>
> any ideas?
>

Yep, here's another dirty trick ;-):

     #include <boost/preprocessor/detail/is_unary.hpp>

     #define SPECIAL (whatever)
     #define IS_SPECIAL BOOST_PP_IS_UNARY

     IS_SPECIAL(a) // 0
     IS_SPECIAL(b) // 0
     IS_SPECIAL(SPECIAL) // 1

It isn't entirely portable to older preprocessors (that's why this code
lives in preprocessor/detail) but should work with latest versions of
the widely-used compilers.

Regards,
Tobias


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net