Optimal basic_string<>::append
Paolo Carlini
pcarlini@unitus.it
Mon Dec 17 08:37:00 GMT 2001
Well, on third thought (hopefully the final one on my part :-) I believe
that your approach, while safe, would not gain us much. That's why: the
reserve call that you spare, either reallocates the string to the required
capacity or not. In the second case it does'nt cost much. In the first
case, the new reallocated string is un-shared and with the required
capacity. As such, inside _M_mutate it is *not* reallocated (see the if at
the beginning of _M_mutate). So...
Cheers,
Paolo.
More information about the Libstdc++
mailing list