C-Macro-Collections
C-Macro-Collections copied to clipboard
list.h should have a sort function
What is the nature of this request?
- New functionalities
Is your feature request related to a problem? Please describe.
I'm working with sprites on a game. I'll create, destroy and loop the sprites over the frame a bunch of times, and sort them only at the end, before rendering. SortedList is not suited for this since it might sort the list automatically unnecessarily. I would much rather have a list.h and manually sort at the appropriate time.
Describe the solution you'd like
have a sort function for list.h
SortedList has a flag is_sorted and only gets sorted when you do operations that require it to be sorted (e.g. element access), but if you still don't want that behavior, then yes, the list.h needs a sort function.
I'll try to get back to your other feature requests as soon as possible. Thank you for the contributions!
No worries, most of them are more like suggestions
I've opened each feature request so we can receive feedback and decide if the change is worth including or not, I've implemented most of the changes already on my own version, so I can open PRs no problem
I think it would be worth it to add an algs.h where you can template quick sorts and binary search algorithms for any data type and have the other data structures reuse the code