I have been using std::vector a lot, and recently I asked myself this question: \"How is std::vector implemented?\"
I had two alternatives:
They use a dynamically allocated array that is regrown as needed. It is necessary to use something like an array so that the elements are contiguous in memory which is guaranteed by the standard.
Incidentally, one common way of regrowing an array is to double the size as needed. This is so that if you are inserting n items at most only O(log n) regrowths are performed and at most O(n) space is wasted.
You can read one implementation for yourself at SGI (where STL was originally conceived).