|
Boost : |
Subject: Re: [boost] [preprocessor] Warning: Incoming
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-06-30 22:03:41
On 6/30/2011 9:31 PM, Lorenzo Caminiti wrote:
> 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.
It is certainly possible to do an IS_TUPLE when the possibilities are
confined but it is not possible to do an IS_TUPLE which works in every
case due to having to use IS_EMPTY to check that there is nothing beyond
the end paren. If you think you have a fail-safe implementation if
IS_TUPLE, feel free to share it.
I will post an IS_TUPLE in my VMD library, with a note about the
possible problem which could occur, but since I have my TTI library
upcoming for review, I will wait until that review is ended.
It is not possible to do an IS_ARRAY or an IS_LIST because it is not
possible to check for a number or the presence of BOOST_PP_NIL. Using
the well known concatenation technique to check for a particular token
fails when the token tested can not be legally concatenated, ie.
BOOST_PP_IS_1(+) fails with a programming error.
It is possible to do an IS_SEQ based on IS_TUPLE, but with the same
limitation IS_TUPLE has. I will post an IS_SEQ in my VMD library
eventually also.
> 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.
I do not control what Paul decides to add to pp-lib, but I am discussing
these possibilities with him and he can decide the end result.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk