On Tuesday, 13 August 2019 at 09:48:52 UTC, Mirjam Akkersdijk wrote:
Hello there,
If I had a DLL, how would I sort it judging by the node contents, the D way?

In C if I were to sort a piece of malloc'd memory pointing to node pointers, I would write my compare function and let qsort sort it out. In D, I tried to use std.algorithm's sort functionality to no avail, because my guess would be it only operates on arrays. This opens up another can of worms as I am not fond of VLAs and D desperately wants to know what the size is at compile time.

You can check std.container.rbtree which will build sorted "list" for you on every Node insert. Again, not sure how this can be done at compile time.

Reply via email to