Functional Sort

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 14 16:50:40 PST 2014


On Saturday, 15 November 2014 at 00:47:41 UTC, Nordlöw wrote:
> On Saturday, 15 November 2014 at 00:45:11 UTC, Meta wrote:
>> `sort` returns a SortedRange, so sort is the function you're 
>> looking for.
>
> Do you mean std.algorithm.sort?
>
> I want a sort that doesn't mutate its input argument.

In that case, just .dup the array before sorting, as you want a 
copy anyway. I don't think there's a sorting function in Phobos 
that doesn't mutate its argument.


More information about the Digitalmars-d-learn mailing list