|
Boost Users : |
From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-10-09 03:40:20
Rene Rivera wrote:
> Johan Nilsson wrote:
>> 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?
>
> What others failed to mention is that you can do this *without*
> macros. For example:
Actually, I need to use macros as the additional parameters actually are
"line = __LINE__, file = __FILE__". Nevertheless you helped me work around
the problem:
#define FOO(x) MyNamedParamFn_with_named_params((x, line = __LINE__, file =
__FILE__))
The above makes it work (well, at least it compiles for the time being).
However I guess that this approach kind of defeats the purpose of using the
BOOST_PARAMETER_(MEM)FUN macros for defining the method ... must think about
that.
Now if I only could get rid of those ugly double parenthesises in the call
to "FOO" - guess I'll just have to wait for preprocessor variadic args
support for that ...
Thanks!
// Johan
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