std::string::reserve vs std::vector::reserve
Joe Buck
Joe.Buck@synopsys.COM
Fri Jun 17 17:13:00 GMT 2005
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.
More information about the Libstdc++
mailing list