Function parameters from TypeTuple

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 17 11:56:31 PDT 2014


On 10/17/2014 11:35 AM, Tofu Ninja wrote:

 > I am not even sure any more, I am starting to get lost in the tuple
 > madness...

You want to write a function that takes an index and a number of arrays; 
and returns an N-ary Tuple where N matches the number arrays passed to 
the function: :p

   assert(multiAccess(0, [42], "s") == Tuple!(int, char)(42, 's'));

And it should work with any number of parameters. Second elements of 
three arrays:

   assert(multiAccess(1, [42, 100], "hello", "world")
          == Tuple!(int, char, char)(100, 'e', 'o'));

Ali



More information about the Digitalmars-d-learn mailing list