custom sorting of lists ?
Codifies
a at b.com
Fri Oct 12 20:59:50 UTC 2018
On Friday, 12 October 2018 at 20:29:27 UTC, Steven Schveighoffer
wrote:
> On 10/12/18 3:40 PM, Codifies wrote:
>> [...]
>
> Unfortunately, I can't find a way to sort a doubly linked list
> in phobos, so comparisons are somewhat moot.
>
> However, if there *were* a sorting routine, generally the
> comparison function is done via whatever type you give it, or
> is given a custom comparison routine.
>
> In my ancient dcollections library linked-list sorting is
> supported via a `less` parameter:
> https://github.com/schveiguy/dcollections/blob/82118cfd4faf3f1ad77df078d279f1b964f274e7/dcollections/LinkList.d#L997
>
> -Steve
I think I'll look later and see if the links (in the dlist) are
accessible, I could at least implement a bubble sort if I can
swap two nodes....
More information about the Digitalmars-d-learn
mailing list