------- 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

Reply via email to