Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2006-10-06 14:20:39


"Johan Nilsson" <r.johan.nilsson_at_[hidden]> writes:

> Hi,
>
> I guess that the subject line isn't even technically correct. What I'd like
> to do is to implement something like the following:
>
> #define FOO(x) MyNamedParamFn(x, d = 3, e = 4)
>
> Where e.g.
>
> "FOO((a = 0, b = 1));"
>
> would expand to the equivalent of:
>
> MyNamedParamFn(a = 0, b= 1, d = 3, e = 4);
>
> Is this possible?

Not with a C++03 preprocessor, because there's no way to "peel apart"
a comma-separated list like (a = 0, b = 1) without knowing how many
elements are in it. With a C99/C++0x preprocessor, you could do it.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net