Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-03-04 20:08:15


"Paul Mensonides" <pmenso57_at_[hidden]> wrote in message
news:002c01c40245$4f522900$6401a8c0_at_c161550b...
> > -----Original Message-----
> > From: boost-bounces_at_[hidden]
> > [mailto:boost-bounces_at_[hidden]] On Behalf Of Jonathan
Turkanis
>

> When you pass EMPTY() as an argument to IF, it expands to nothing
before the
> replacement list is rescanned, yielding:

Somehow I thought EMPTY() would be lazier. I guess it can't be that
smart -- it wouldn't know how lazy to be.

> #define PARAM(has_param) \
> BOOST_PP_IF( \
> BOOST_PP_IDENTITY(typename Param), \
> BOOST_PP_EMPTY \
> )() \
> /**/
>
> // or:
> // #define PARAM(has_param) \
> // BOOST_PP_EXPR_IF(has_param, typename Param) \
> // /**/
>
> #define MACRO(has_param) \
> template< \
> PARAM(has_param) BOOST_PP_COMMA_IF(has_param) \
> typename T> \
> struct name { }; \
> /**/

I like the first better because it's self-contained.

Thanks for your patience with my preprocessor naïveté.

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk