I've found a hybrid works well - TechRepublic
General discussion
April 12, 2002 at 03:15 PM
masdaq

I’ve found a hybrid works well

by masdaq . Updated 24 years, 2 months ago

As an embedded C++ developer, I often have to create features others find intrinsic to the STL, for example. As a result, I use a hybrid model of arrays and linked lists to mitigate and exploit the advantages of both. I’m not allow to use new and deletes (to costly performance wise for our architect) and I must always know and/or limit my memory usage. Thus I always know the array size, though this model is not restricted to this. I create (reserve) an array of N objects. I use a stack to immediately retrieve an unused object (if any). Finally, I use a linked list of array indexes to find, search, order, etc., my allocated objects. If I want to order on more than one key within the allocated objects, I create a linked list or tree for each key, whenever appropriate. I have found this collection model to be both flexible, scalable, and efficient. Comments?

This discussion is locked

All Comments