Boost logo

Boost :

Subject: Re: [boost] [preprocessor] Warning: Incoming
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-06-30 21:31:22


On Wed, Jun 29, 2011 at 10:54 AM, Edward Diener <eldiener_at_[hidden]> wrote:
> Nonetheless macros using variadics to identify pp-lib data types on the fly
> might still be useful and I have already come up with a pretty good
> IS_TUPLE. Whether an IS_ARRAY, IS_LIST, or IS_SEQ is posible I shall see.

Useful indeed. I have implemented some sort of IS_TUPLE within
Boost.Local. BOOST_LOCAL_PARAMS() uses it to accept both the follow
syntaxes when variadics are present:

BOOST_LOCAL_PARAMS(int x, int& y) // (1)
BOOST_LOCAL_PARAMS( (int x) (int& y) ) // (2)

Essentially (going by memory):

#if BOOST_VARIADICS_MACRO

#define BOOST_LOCAL_PARAMS(...) \
    BOOST_PP_IIF(IS_TUPLE(__VA_ARGS__), \
        BOOST_LOCAL_PARAMS_TUPLE_ /* for (1) */ \
    , \
        BOOST_LOCAL_PARAMS_SEQ_ /* for (2) */ \
    )(__VA_ARGS__)

#else // variadics

#define BOOST_LOCAL_PARAMS(seq) BOOST_LOCAL_PARAMS_SEQ_(seq) // only (2) :(

#endif // variadics

> I will probably end up putting any additions in my VMD library for the time
> being and if Paul decides that he wants them for pp-lib sometime in the
> future they will eventually go there.

I'd prefer to see IS_TUPLE (and possibly all IS_XXX) as part of these
Boost.Preprocess variadics changes.

--Lorenzo


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