On Wednesday, 2 May 2012 at 15:27:58 UTC, Jabb wrote:

import std.algorithm;
void main() {
        uint[string] counts = [ "a":4, "b":5, "c":3, "d":1 ];
        string[] keys = counts.keys;

        sort!((a, b) { return counts[a] > counts[b]; })(keys);
}

Did you try
string[] keys = counts.keys.dup;
?

Sometimes you get weird aliasing issues, as the sort! template
modifies the original array.

Reply via email to