Regarding implementing a stable sort for Phobos

Jesse Phillips Jessekphillips+D at gmail.com
Tue Mar 13 11:40:20 PDT 2012


On Tuesday, 13 March 2012 at 14:31:59 UTC, Andrei Alexandrescu 
wrote:
> On 3/13/12 1:31 AM, Xinok wrote:
>> - I wrote it to sort random-access ranges *without* slicing, 
>> but I think
>> the exclusion of slicing makes it slower. I'm writing a 
>> separate
>> implementation which uses slicing and I'll keep it if it's 
>> much faster.
>
> Having random access implies having slicing.

Currently it can not be assumed that isRandomAccessRange has 
slicing:

http://dlang.org/phobos/std_range.html#isRandomAccessRange

Maybe it should be a requirement?

It seems to me that Bidirectional ranges can't be infinite, and 
by extension Random Access ranges too. But slicing could be 
supported on an infinite range. So hasSlicing is still useful, 
but I think could be a good requirement on RA ranges.


More information about the Digitalmars-d mailing list