Sorting array or AssocArrays by value.
Me Here
p9e883002 at sneakemail.com
Sun May 4 18:47:05 PDT 2008
Manfred Nowak wrote:
> This isn't the first time a request for the permutation computed by the
> sort routine comes up. Should such be incorprated into the language?
>
It struck me that the ability to pass a coderef (sorry, delegate :) to the sort
method
that was called back with both the [index, value] or [key,value] of the items
being
compared and returning -1, 0, +1, would allow for custom sorting.
The other notion that crossed my mind was having the ability to locally (scoped)
override the opCmp of built-in types, but that would require all opCmps to
expect two pairs.
b.
--
More information about the Digitalmars-d
mailing list