I have been using std::vector a lot, and recently I asked myself this question: \"How is std::vector implemented?\"
std::vector
I had two alternatives:
I believe the STL uses option #2 (or something similar) because a std::vector<> is guaranteed to store the elements in contiguous memory.
If you're looking for a memory structure that doesn't need to use contiguous memory, look at std::deque.