www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - ported a sortable list from my old C code

reply Codifies <a b.com> writes:
https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e

its a bit fugly at the moment and I want to use something other 
than a void pointer (any?) (the whole thing was very pointer 
centric as everything was malloc'd...)

I'm not entirely sure it would benefit from turning into a class ?

Does anyone has any ideas on improving this sortable list
Oct 13 2018
next sibling parent reply Alex <sascha.orlov gmail.com> writes:
On Saturday, 13 October 2018 at 11:11:41 UTC, Codifies wrote:
 https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e

 its a bit fugly at the moment and I want to use something other 
 than a void pointer (any?) (the whole thing was very pointer 
 centric as everything was malloc'd...)

 I'm not entirely sure it would benefit from turning into a 
 class ?

 Does anyone has any ideas on improving this sortable list
Something is wrong with the link :(
Oct 13 2018
next sibling parent Codifies <a b.com> writes:
On Saturday, 13 October 2018 at 11:28:08 UTC, Alex wrote:
 On Saturday, 13 October 2018 at 11:11:41 UTC, Codifies wrote:
 https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e

 its a bit fugly at the moment and I want to use something 
 other than a void pointer (any?) (the whole thing was very 
 pointer centric as everything was malloc'd...)

 I'm not entirely sure it would benefit from turning into a 
 class ?

 Does anyone has any ideas on improving this sortable list
Something is wrong with the link :(
gutted .... anywhere else I can post it?
Oct 13 2018
prev sibling parent Codifies <a b.com> writes:
On Saturday, 13 October 2018 at 11:28:08 UTC, Alex wrote:
 Something is wrong with the link :(
https://dpaste.dzfl.pl/af9e6f6ce53e
Oct 13 2018
prev sibling next sibling parent Stanislav Blinov <stanislav.blinov gmail.com> writes:
On Saturday, 13 October 2018 at 11:11:41 UTC, Codifies wrote:

 Does anyone has any ideas on improving this sortable list
Yes. Use an array. No, really, use an array. Now, really, use an array. If reallocations while building your paths become a problem, you can write a deque (bucket array) or a dlist. But still, afterwards just convert it to array and use that.
Oct 13 2018
prev sibling parent Steven Schveighoffer <schveiguy gmail.com> writes:
On 10/13/18 7:11 AM, Codifies wrote:
 https://run.dlang.io/gist/b8b03ce3246951b5356db064ab68b22e
 
 its a bit fugly at the moment and I want to use something other than a 
 void pointer (any?) (the whole thing was very pointer centric as 
 everything was malloc'd...)
 
 I'm not entirely sure it would benefit from turning into a class ?
 
 Does anyone has any ideas on improving this sortable list
Yes, use mergesort instead of bubble sort. As I said, I will attempt to add sorting to Phobos for slist and dlist. -Steve
Oct 13 2018