|
Boost : |
Subject: Re: [boost] [Preprocessor] Adding variadic macros support
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-11-24 16:17:45
On 11/24/2010 2:58 PM, Matt Calabrese wrote:
> On Wed, Nov 24, 2010 at 3:22 AM, Mathias Gaunard<
> mathias.gaunard_at_[hidden]> wrote:
>
>> Other possible applications could be to accept the sequence (a)(b, c, d)(e)
>> as being the same as (a)((b, c, d))(e).
>>
>
> I've recently done exactly this in my Generic and AutoFunction libraries,
> only instead of wrapping the elements with commas in extra parentheses, it
> wraps them all in extra parentheses. The macro takes a "variadic" sequence
> and yields the corresponding Boost.Preprocessor sequence. I'll link to the
> implementation on my next sandbox commit (which should be tonight).
One problem with variadic macro usage is that in a variadic macro itself
you can only use variadic data once as the last parameter the macro
takes. Of course you can use the variadic data in the expansion to the
macro as you please, and my library easily lets you grab any token(s) of
that variadic data and use it in the expansion.
Please take a look at what my library has to offer and hopefully you can
use some of the functionality in the Generic and Autofunction libraries
to simplify syntax if you find it worthwhile.
If you have any suggestions about my library I will be glad to hear
them. Thanks for taking an interest in the library.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk