I have created a MemoryManager
class which is basically a wrapper around two vectors of pointers that manage lifetime of heap-allocated objects.
O
You could avoid moving elements of the container by maintaining a free-list (see http://www.memorymanagement.org/glossary/f.html#free.list).
To avoid invalidation of references to elements you can use a std::deque if you do not insert or erase in the middle. To avoid invalidation of iterators you can use a std::list.
(Thanks Howard Hinnant)