On Tuesday, 13 August 2019 at 12:34:46 UTC, bachmeier wrote:
I'm confused by this statement. Are you referring to the qsort in C's stdlib? I had never heard of using that to sort a linked list, so I searched, and it is not possible.

Ah yes, maybe I should have elaborated. In C, you can just create an array

(1) struct Node* nodes[buf_size];

and then loop over it, filling it with

(2) nodes[i] = (DLLbuf + i * sizeof(struct Node));

subsequently calling our dear friend from stdlib

(3) qsort(nodes, buf_size, sizeof(struct Node*), buf_compare_function);

You can then rechain all nodes together but that's a bit out of scope for this thread unless you do really want me to work it out :)

But I was looking for a more D-specific approach to solve this, as it feels archaic to do it the C way. If there is anyone with a better one please let me know.

Reply via email to