A
Arnaud Debaene
And there is also in intermediate "mix" between the two : the deque.Peter said:Wow, you ask a simple question..... : )
As I understand it, the 'old' STL containers make a distinction in
this regard. List's are linked lists, and so are not necessarily
contiguous in memory. Vector's are the STL equivalent of contiguous
lists. The reason for both is that vector's are better at lookup
performance (randomly accessible and therefore a fixed length of
lookup time); but suffer when being deleted from or resized, since
this is often done by moving the entire end of the list and
allocating a bigger vector somewhere else and copying over,
respectively. List's are worse at lookup performance since they
require serial lookup (linking thorugh the list from the header,
which is takes a variable length of time based on 'distance' from
header), but benefit when it comes to deletion and resizing since an
element can be removed without moving anything else, and resizing
just means finding a large enough memory space anywhere for the added
element.
This is of course basically wrong : processor speed has never changedMy opinion is this: with a faster computer and more memory it really
doesn't matter which method is used! : )
anything to algorithm complexity. When manipulating great number of elements
(several tens of thousands), the difference between logarithmic and linear
complexity is as important today as it was 10 years ago.
Arnaud
MVP - VC