Splitting a range into a range of tuples
Adam via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jun 1 17:39:06 PDT 2015
> auto result = input
> .splitter(',')
> .map!splitter
> .joiner
> .map!(to!int)
> .chunks(2)
> .map!array
> .array
> .sort()
> .retro;
>
Thanks for the reply. I'm a bit confused by the splitter followed
immediately by the joiner...and then it kinda falls apart for me.
Here's where I've ended up:
auto result =
input
.splitter(",") // range of strings
.map!(v => v.splitter(" ") // range of ranges strings
.array // range of arrays of strings
.to!(int[])) // range of arrays of ints
.Tuple!(int,int);
Everything is fine until I try to instantiate Tuples with my
arrays. Then I get an error that says none of the overloads of
the constructor are callable with these arguments. But I see
this: http://dlang.org/phobos/std_typecons.html#.Tuple.this.2 ,
which makes me think it should work. Am I doing something wrong?
More information about the Digitalmars-d-learn
mailing list