|
Boost : |
Subject: Re: [boost] [Preprocessor] Adding variadic macros support
From: Thell Fowler (tbfowler4_at_[hidden])
Date: 2010-11-25 22:29:08
Edward Diener <eldiener <at> tropicsoft.com> writes:
>
> On 11/24/2010 3:22 AM, Mathias Gaunard wrote:
> > Variadic macros would allow to support tuples better in Boost.PP, as it
> > would not be necessary to specify the size of the tuple, and it could be
> > possible to provide other nice features around tuples.
> >
> > Other possible applications could be to accept the sequence (a)(b, c,
> > d)(e) as being the same as (a)((b, c, d))(e).
> >
> > If you think other things could be improved in PP with variadic macros,
> > feel free to point out where.
> >
> > The question is: how should it be done?
> > Should the new macros be named, say, BOOST_PPV_*? Should the macros in
> > BOOST_PP_* be "overloaded" on arity (a possibility with variadic macros)
> > so as to exhibit both the old and new interface?
>
> Please see my variadic_macro_data library in the sandbox. I have already
> addressed the problem of uniting variadic macros with Boost PP there as
> well as providing the support for tuples which you suggest in your
> opening paragraph above.
>
Thank you very much for doing this. Just this week I ran across need to use
variadic macros and was hunting the various 'solutions' for something that would
get my job done. Essentially I was able to take a bunch of args and prefix
them, build a list, and pass that list to the target function. Very nice indeed.
I know my usage must be pretty basic, but being able to do it is extremely nice.
Here's what I did:
http://thell.pastebin.com/zJvXhHP0
By the way, I'm using VC 9 and it worked great. Outside of learning how some of
the functions of both the VMD and PP libs worked out their expansions, this was
as easy as it could get.
-- Thell
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk