Original Post
As I understand it, in STL: - Vectors are a contiguous block of memory with O(1) access time for any element, but are slow at insertion/deletion from the middle (since the entire following block has to be shifted). - Lists are doubly-linked lists, with each element in an arbitrary place in memory, alongside a pointer to the next and previous elements. Insertion/deletion from the middle is fast because it's just a bit of pointer tweaking and a new allocation. Slow random access due to traversing the list. But my understanding of deques isn't so good - how do they hold elements in memory? My project requires dynamic arrays with a fair amount of inserting/deleting from the middle but also good access time when being iterated from begin to end. I've been using deques, but how does inserting and erasing from the middle compare to vectors and lists? How does the efficiency of iterating a deque compare to iterating a vector and list? Thanks