sortOn: sorts range of aggregates by member name(s)
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 9 05:34:43 PST 2014
Nordlöw:
> What do you mean by sufficient value?
Every thing you add to Phobos std.algorithm&std.range increases
the amount of things D programmers have to understand and keep in
_active memory_. So you have to balance the desire to add
specialized functionality with the desire to keep that complexity
low. And I think adding sortBy isn't a good idea.
If you really want to do something like that, I think it's better
to add something more like Python "operator.attrgetter"
(https://docs.python.org/2/library/operator.html ), that can be
used with the standard sort:
items.sort!(fieldGetter("field1", "field2"));
Bye,
bearophile
More information about the Digitalmars-d
mailing list