Fixed-Length Array Sorting

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 7 09:03:00 PDT 2016


On 04/07/2016 09:28 AM, Nordlöw wrote:
> On Thursday, 7 April 2016 at 13:09:22 UTC, Andrei Alexandrescu wrote:
>> This is a good start but we'd need a more principled attack on the
>> problem. There are optimal sorting networks for a number of small
>> sizes; a good start is Knuth's TAoCP Volume 3 but there's newer
>> research as well, which needs to be investigated. A sorting network in
>> D can be nicely done with variadic template parameters, e.g. this:
>
> Could these fixed-length overloads be reused in the deepest recursions
> of existing Phobos algorithms, such as std.algorithm.sorting.sort()

Could and should.

> provided that the comparison-predicate matches.

How do you mean that?


Andrei


More information about the Digitalmars-d mailing list