Variadic Template Pattern

Joel Nilsson via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 10 00:20:00 PDT 2017


On Sunday, 9 July 2017 at 21:21:03 UTC, FoxyBrown wrote:
> *snip*


If I understand what you want to achieve correctly, this can sort 
of be done with tuples:

void func(Tuple!(int, string)[] args...){
   args[0][0] // first int
   args[1][0] // second int
   args[0][1] // first string
   // and so on
}

Of course you would have to pass tuples as the arguments, so it's 
fairly verbose:

void func(tuple(1, "one"), tuple(2, "two"), tuple(3, "three"));


More information about the Digitalmars-d mailing list