S
slyi
Is it ok to assume that the following assertion is valid for all
implementations of std::vector?:
std::vector<T> v(10);
T* p = &v[0];
for (size_t n=0; n < v.size(); n++)
assert( p+n == &v[n] );
or is it possible (does the standard allow) for an implementation to
use some weird internal storage scheme for the contained random access
sequence?
thanks,
slyi
implementations of std::vector?:
std::vector<T> v(10);
T* p = &v[0];
for (size_t n=0; n < v.size(); n++)
assert( p+n == &v[n] );
or is it possible (does the standard allow) for an implementation to
use some weird internal storage scheme for the contained random access
sequence?
thanks,
slyi