custom sorting of lists ?

Steven Schveighoffer schveiguy at gmail.com
Mon Oct 22 14:11:23 UTC 2018


On 10/19/18 3:58 PM, Carl Sturtivant wrote:
> On Friday, 19 October 2018 at 17:53:58 UTC, Stanislav Blinov wrote:
>> On Friday, 19 October 2018 at 17:40:59 UTC, Carl Sturtivant wrote:
>>
>>> If we imagine an Ordered Range being a finite Range of some kind with 
>>> the additional property that its values are ordered (--- exact 
>>> definition needed ---)...
>>
>> There's already a SortedRange: 
>> https://dlang.org/phobos/std_range.html#.SortedRange
> 
> That's nice. So perhaps all this can be done in using the existing 
> machinery in Phobos.
> 

Again, the benefit of linked lists here is we don't have to actually 
move any data, we are just rearranging pointers.

We can certainly create a mergesort routine that works with any data 
types, as long as it has scratch space to move the data around. But that 
isn't as effective or efficient as a dedicated linked-list routine.

-Steve


More information about the Digitalmars-d-learn mailing list