2 ms·
I usually end up with a singly linked list when implementing a singleton API that needs to support an arbitrary number of application created objects. Rather th
by sgtnoodle 6y ago
I usually end up with a singly linked list when implementing a singleton API that needs to support an arbitrary number of application created objects. Rather than have the singleton pre-allocate the memory, the application has to do it, then pass it into the API to use for the lifetime of the program. The various parts of the application knows how many objects it needs, and can statically allocate just the right amount of memory.