Boost logo

Boost :

Subject: Re: [boost] [TTI] Review
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2011-07-11 17:02:39

Edward Diener-3 wrote:
> On 7/11/2011 2:45 PM, Joel falcou wrote:
>> See :
>> for the file, line 85 and after.
>> The point is it works without variadics
> Line 87: #define NT2_PP_DETAILS_STRIP_PARENS_I(...) 1,1
> Line 91: #define NT2_PP_DETAILS_TEST_ARITY_I(a,b,c,...) c
> Line 96: #define NT2_PP_DETAILS_MAYBE_STRIP_PARENS_2_I(...) __VA_ARGS__
> Clearly it needs variadic macro support.
> I have already added a REMOVE_PARENS ( the equivalent to NT2_PP_STRIP(X)
> in your URL above ) to a proposed addition to pp-lib which I am
> discussing with Paul Mensonides, based on the updated variadic macro
> support on which both of us worked and which is now in the Boost trunk.
> My point is also that I may well be able to simplify the
> BOOST_TTI_TEMPLATE macros in TTI using variadic macro support
> techniques, as Lorenzo suggested, but I do not feel correct in dropping
> macro support support for compilers which do not support variadic macros
> although I understand there are few of them left.

I will later reply to all your comments on my review but let me quickly
clarify a couple of things.

My suggestion was to have the *same* macro TTI_TEMPLATE handle *both*
variadics tupletes and sequences. The pp skeleton code will go something


#define TTI_TEMPLATE_VA_(...) \

#define TTI_TEMPLATE(...) \
        TTI_TEMPLATE_VA_ \
    , \

#else // variadics


#endif // variadics


This macro could be expanded to also detect a single token and accept the
trait parameters in front. The full grammar will then read something like:

TTI_TEMPLATE(trait, [tpl_signature_ {class | struct }] name)

If the compiler supports variadics:

    tpl_signature_va_ | tpl_signature_seq_ // you can use either variadics
or sequences :)

If not:

    tpl_signature_seq_ // you must use sequences (because variadiacs are not


    template( (class | typename | type_identifier | tpl_signature_seq_) ...
) // the pp-seq

    template< {class | typename | type_identifier | tpl_signature_seq_} ...
> // the pp-variadic tuple

Where lexical conventions are:
    [token] := token is optional
    token1 | token 2 := either token1 or token2
    {expr} := the token(s) resulting from the inner expression epxr
    (tokens) ... := repeat tokens within parenthesis one or more times
(tokens) (tokens) etc
    tokens ... := repeat tokens separated by commas one or more times
tokens, tokens etc

I think this should be possible but usually the devil is in the details...
so I don't know unless someone tries to implement it :)

The real question still stands: Would this be a better interface for
TTI_TEMPLATE? (You know my opinion is yes, but that's just my opinion.)

Please ask questions and let me know if I am not able to explain myself.


View this message in context:
Sent from the Boost - Dev mailing list archive at

Boost list run by bdawes at, gregod at, cpdaniel at, john at