The C++03 standard added wording to make it clear that vector elements must be contiguous.
C++03 23.2.4 Paragraph 1 contains the following language which is not in the C++98 standard document:
The elements of a vector
are stored
contiguously, meaning that if v
is a
vector<T, Allocator>
where T
is
some type other than bool
, then it
obeys the identity &v[n] == &v[0] +
n
for all 0 <= n < v.size()
.
Herb Sutter talks about this change in one of his blog entries, Cringe not: Vectors are guaranteed to be contiguous:
... contiguity is in fact part of the
vector abstraction. It’s so important,
in fact, that when it was discovered
that the C++98 standard didn’t
completely guarantee contiguity, the
C++03 standard was amended to
explicitly add the guarantee.