View Single Post
Bjarne Stroustrup
Posts: n/a
Russell Hanneken <(E-Mail Removed)> wrote in message news:<4K32c.22875$(E-Mail Removed)>...
> Ravi wrote:
> > Is a std::vector *guaranteed* to be contiguous in memory? Bjarne
> > Stroustrup says it takes constant time to access a vector element and
> > that implies contiguous storage but I just wanted to double-check. I
> > heard that ISO 14882 standard did not guarantee this. Has this changed?
> > Any pointers will be appreciated.

Yes. The 2003 "technical corrigendum" corects that. 23.2.4[1] says
"The elements of a vector are stored contiguously".

As Russell pointed out, this was always the intent and all
implementations always did it that way

-- Bjarne Stroustrup;
Reply With Quote