6 Oct
2006
6 Oct
'06
7:24 p.m.
"David Abrahams"
"Johan Nilsson"
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.
What is possible, though, is something like: FOO_2(a = 0, b = 1) or FOO((a = 0)(b = 1)) Regards, Arkadiy