constructed variadic call

Erik Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 3 13:17:57 PDT 2016


On Monday, 2 May 2016 at 18:56:59 UTC, Stefan Koch wrote:
> On Monday, 2 May 2016 at 18:22:52 UTC, Erik Smith wrote:
>> Is there way to construct an "argument pack" from a non-static 
>> array (like the switch below)?  I need to transport a variadic 
>> call through a void*.
>>
>> switch (a.length) {
>>   case 1: foo(a[1]); break;
>>   case 2: foo(a[1], a[2]); break;
>>   case 3: foo(a[1], a[2], a[3]); break;
>> ...
>> }
>
> Yes there is.
> Using a string mixin.

I'm not sure how to apply mixins here because they require 
compile time evaluation and a.length is runtime.  Ideas?

erik


More information about the Digitalmars-d-learn mailing list