Which data structure would allow easily adding and removing items and be easy to fully destroy?

  c++, data-structures, garbage-collection

I’m looking to create my own garbage collector made for a specific purpose:

  • I want to be able to quickly allocate and add and remove and free many items of the same type/size
  • I would like to be able to quickly wipe away all items.

Double linked list might do it since I always have a direct ref to the item. Would be nice to be able to wipe it out quickly without iterating through all items though. Maybe I just allocate in chunks since all items the same size though it makes normal add/remove slower but open to ideas.

Source: Windows Questions C++

LEAVE A COMMENT