avoid toLower in std.algorithm.sort compare alias

Jay Norwood jayn at prismnet.com
Sun Apr 22 21:32:51 PDT 2012


On Sunday, 22 April 2012 at 00:36:19 UTC, bearophile wrote:
> Performing the toLower every time the cmp function is called 
> doesn't change the O complexity. In Phobos there is an 
> alternative sorting (Schwartzian sorting routime) that applies 
> a function to each item before sorting them, usually is much 
> slower than the normal sorting, but maybe this time it's 
> convenient.
> Bye,
> bearophile

The shwartzSort works fine.
Thanks,
Jay

std.algorithm.schwartzSort!(std.string.toLower, "a < b")(dirs);

G:\d\rmdir2\rmdir2\rmdir2\Debug>rmdir2
removing: g:\tz
finished! time:699 ms



More information about the Digitalmars-d-learn mailing list