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:
// lib.vector.capa city capacity:
size_type size() const;
size_type max_size() const;
void resize(size_typ e sz, T c = T());
size_type capacity() const;
bool empty() const;
void reserve(size_ty pe n);
Is it reasonable for me to assume my vector /will/ stay put if I don't force
a reallocation by adding to it?
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
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:
// lib.vector.capa city capacity:
size_type size() const;
size_type max_size() const;
void resize(size_typ e sz, T c = T());
size_type capacity() const;
bool empty() const;
void reserve(size_ty pe n);
Is it reasonable for me to assume my vector /will/ stay put if I don't force
a reallocation by adding to it?
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Comment