On 10/12/18 4:59 PM, Codifies wrote:
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
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....
I really should copy my mergesort implementation to Phobos. It's really
simple, and there's no reason not to have sortable lists (both singly
and doubly linked).
-Steve