S
Steven T. Hatton
My understanding of the containers in the Standard Library is that they can
move out from under pointers and references if they are resized.
Stroustrup suggests I can reserve the capacity I will need, and thus avoid
having the vector (or other container) realocated with a different address
range. I have the sense this is not explicitly specified in the Standard.
I have not, however, read the entire ISO/IEC 14882:2003. Here's a link to
an oder version draft of the Standard:
http://www.kuzbass.ru:8086/docs/isocpp/lib-containers.html#lib.vector
// lib.vector.capacity capacity:
size_type size() const;
size_type max_size() const;
void resize(size_type sz, T c = T());
size_type capacity() const;
bool empty() const;
void reserve(size_type n);
Is it reasonable for me to assume my vector /will/ stay put if I don't force
a reallocation by adding to it?
move out from under pointers and references if they are resized.
Stroustrup suggests I can reserve the capacity I will need, and thus avoid
having the vector (or other container) realocated with a different address
range. I have the sense this is not explicitly specified in the Standard.
I have not, however, read the entire ISO/IEC 14882:2003. Here's a link to
an oder version draft of the Standard:
http://www.kuzbass.ru:8086/docs/isocpp/lib-containers.html#lib.vector
// lib.vector.capacity capacity:
size_type size() const;
size_type max_size() const;
void resize(size_type sz, T c = T());
size_type capacity() const;
bool empty() const;
void reserve(size_type n);
Is it reasonable for me to assume my vector /will/ stay put if I don't force
a reallocation by adding to it?