Error: no property 'sort' for type 'ulong[string]' , sometimes

bearophile bearophileHUGS at lycos.com
Sun Oct 20 09:06:53 PDT 2013


Derix:

What did I miss ?

Never use the built-in ".sort" property, it's deprecated, buggy 
and slow. It's still in the language for unknown reasons, perhaps 
to create nice traps for language newcomers.

Also, what do you mean sorting an associative array? To sort the 
keys (notice the name with two leading "a" and the trailing () to 
call the Phobos sort function of std.algorithm that you have to 
import):

auto sortedKeys = aarr.byKey.array.sort().release;
auto sortedValues = aarr.byValua.array.sort().release;

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list