sortOn: sorts range of aggregates by member name(s)
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 4 16:34:53 PST 2014
On Wednesday, 5 November 2014 at 00:32:32 UTC, Nordlöw wrote:
> Has there been any proposals to add a sort-wrapper, say sortBy,
>
> in cases such as
>
> struct X { double x, y, z; }
> auto r = new X[3];
>
> used as
>
> r.sortBy!("x", "y")
>
> sorting r by value of "x" then "y".
>
> If not and anybody is interest I could write one and make PR in
> std.algorithm.
I think you're looking for multiSort.
http://dlang.org/phobos/std_algorithm.html#.multiSort
More information about the Digitalmars-d
mailing list