This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: std::string::reserve vs std::vector::reserve
On Thu, Jun 16, 2005 at 12:41:58PM +0100, Jonathan Wakely wrote:
> So to summarise, the standard doesn't place any strict requirements on
> the behaviour, so it is best not to assume anything more than
> "capacity() will always be greater than or equal to size()" for strings.
It might be possible to assume a bit more. The standard permits
assignment to reduce the capacity, but the usual reason for doing
reserve() is to speed up a subsequent sequence of append operations.