|
Boost Users : |
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2006-10-06 15:59:56
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:
template <typename ArgPack>
void MyNamedParamFn(ArgPack args)
{
//...
}
template <typename ArgPack>
void Foo(ArgPack args)
{
MyNamedParamFn((args, d = 3, e = 4));
}
Foo((a = 0, b = 1));
HTH.
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo
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