Sort Associative Array by Key

Paul Backus snarwin at gmail.com
Sun Aug 25 21:13:05 UTC 2019


On Sunday, 25 August 2019 at 19:03:10 UTC, JN wrote:
> I think normal lambdas are better than these string ones:
>
> foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a => 
> a[1]).writeln;

You can also use names instead of numeric indices:

foo.byPair.array.sort!((a, b) => a.key < b.key).map!(a => 
a.value);


More information about the Digitalmars-d-learn mailing list