constructed variadic call
Erik Smith via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 3 14:39:56 PDT 2016
> I don't think it's possible to call a vararg function whose
> number of arguments is only known at runtime, for the same
> reasons it is impossible in C [1].
>
> Your switch statement is probably the best you can do, other
> than rewriting the API to not use varargs (which, depending on
> what the function is doing, I would recommend). You can
> possibly use string mixins or static foreach to avoid repeating
> the case clauses.
>
> [1] Populating a va_list:
> http://stackoverflow.com/questions/988290/populating-a-va-list
That was fast :). The generation idea helps a little - thanks.
It works though and I can't use va_list in this case.
erik
More information about the Digitalmars-d-learn
mailing list