Converting array in to aliased tuple type.

aliak something at something.com
Mon Dec 25 12:03:32 UTC 2017


Hi, been looking for a way to convert an array to a tuple, but 
can't seem to find one. Is there one?

Looking for something like:

alias Point = Tuple!(int, "x", int, "y");
enum data = "1,2:8,9";
auto points = data
   .split(':')
   .map!(a => a
     .split(',')
     .map!(to!int)
   )
   .map!Point; // <-- this works if you do `.map!(a => Point(a[0], 
a[1]));` instead

Cheers!



More information about the Digitalmars-d-learn mailing list