Custom compare function for array.sort on an integer array?

Sequ user at example.net
Tue Apr 19 06:09:51 PDT 2011


> If your are talking about D2, then use std.algorithm sort
> Like taken from docs below:
>
> bool  myComp(int  x,int  y) {return  x>  y; }
> sort!(myComp)(array);
>
>
> See also:
> http://www.digitalmars.com/d/2.0/phobos/std_algorithm.html#sort
>
> --
> Dmitry Olshansky
Ah, yes, thanks; that looks like it could be perfect.


More information about the Digitalmars-d-learn mailing list