Sorting a zipped range

bearophile bearophileHUGS at lycos.com
Thu Feb 27 15:48:47 PST 2014


Ben Jones:

> auto sorter = (Tuple x, Tuple y) => x.get(0) < y.get(0);
> sort!sorter(zip(a,b));

You can write that as (untested):

zip(a, b).sort!((x, y) => x[0] < y[0]);

Or even just:

a.zip(b).sort!q{ a[0] < b[0] };

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list