Iterate/sort associative array by value?

diniz diniz at posteo.net
Mon Apr 8 13:47:28 UTC 2019


Le 07/04/2019 à 19:16, Seb via Digitalmars-d-learn a écrit :
> Then you can do:
> 
> ---
> ["a": 1].byPair.array.sort!((a, b) => a.value < a.value).release.each!writeln;
> ---
> 
> You'll have a sorted array with key and value props.

That's what I would do: just operating on an array of {k,v} pairs.

-- 
diniz {la vita e estranj}


More information about the Digitalmars-d-learn mailing list