[Bug libstdc++/23494] std::basic_string <> capacity weirdness
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Tue Aug 23 09:57:00 GMT 2005
------- Additional Comments From pcarlini at suse dot de 2005-08-23 09:56 -------
When push_back notices that s1 is shared and clones it (via reserve), creates
a new string (not shared) of capacity >= original size (according to an
exponential grow policy) but unrelated to the original capacity. I don't think
it would be wise to always take into account the original capacity, which can
be > size for *zillions* of different reasons, depending on the history of the
string, and not explicitly requested by the user via a previous reserve. Also
notice that a *series* of push_back is typically very fast, because of the
exponential reallocation policy and very often there is no real need for a
reserve to obtain good performance. Also notice that some artifacts are
generally considered unavoidable in a reference counted implementation of
string, as our default one (in mainline, we provide also an alternate
implementation in ext/vstring.h)
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23494
More information about the Gcc-bugs
mailing list