How to delegate varargs
Tomas Lindquist Olsen
tomas at famolsen.dk
Tue Nov 20 15:14:54 PST 2007
Bill Baxter wrote:
>
> I don't care how it works, but some clean way to forward function
> varargs that doesn't look like a clumsy afterthought would be fantastic.
>
> --bb
From a users point of view the only change to the D spec would be:
At the end of the section "D-style Variadic Functions" append:
<<<<<
The variadic arguments can be forwarded to another D-style variadic function by passing '...'
as an argument. The forwarded arguments are bit-copied onto a new argument list.
void foo(...)
{
// do something
}
void bar(...)
{
foo(1, ..., 3.0);
}
>>>>>
With this approach there is still no way to slice the argument list, for that a more high-level
approach like the ones mentioned by Jarret in the "Variadic arguments and map" thread is
probably needed.
More information about the Digitalmars-d
mailing list