This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Off topic] Re: C++ arrays vs vectors



> | Several people, including Dr Stroustrup, recommended assuming contiguous
> | vectors anyway, and avoiding any hypothetical weird STL implementation
> | that does it differently (nobody knew of any in the real world).
> 
> A vector<> implementation that is not contiguous could have the advantage
> that when the vector needs to be enlarged, and a realloc() would cause a
> need for moving the data, then instead one doesn't need to move the
> existing data.

Right, but we already have a container with that property.  It is
called deque<>.  And yes, the SGI implementation enlarges it without
needing to duplicate all the elements.

Given this, I don't think there is a compelling reason to implement
vector<> that way.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]