deques, vectors and destructors.
Just a quick question, stemming from my previous thread regarding the article about queues: When you 'erase' an element from a deque (or even vector), is it guaranteed that its destructor will be called immediately, or may the destruction be delayed until the container's internal sequence of elements is reallocated? i.e. if resources are released in the objects' destructors, then there could be unwanted side-effects if there is an indefinite delay before their destruction. I ask, simply because I can't think of an efficient and failsafe way to destroy single elements of an array (assuming that's how deques are implemented), and it would be inefficient to destroy/recreate all elements of the container each time a pop_back() or pop_front() occurs.