Hi again...

I need to use an efficient container that satisfies the following properties:
1) Has the ability to add elements at the end.
2) Has the ability to remove elements anywhere.
3) Has the ability to quickly access elements anywhere within the container (random access).

I tried using the STL containers, specifically the list and vector templates. Lists don't have the 3rd property, so the workaround was very slow compared to what I had already designed already. Similarly, I found vectors to be also a bit slow in comparison.

My own design is simple, but lacks the ability to remove elements, short of recreating the whole container. I have a function which needs to choose elements repeatedly and randomly from within this container, but in the meantime, some elements are 'killed'/removed from the container. I am resorting to putting a bool variable in the element class which determines whether the element is 'alive' or 'dead'. This, coupled with the randomness and repeatedness of the choosing function is leading to inefficiency.

Is there any possible way to fix it, short of removing the randomness?