std::string::reserve()
Paolo Carlini
pcarlini@suse.de
Wed Feb 11 22:30:00 GMT 2004
Neil Ferguson wrote:
> I've attached diffs against latest CVS that try to avoid doing
> this, and I'd be interested to know what you think.
Hi Neil, thanks for your message. A few observations:
1- If you plan contributing patches of this size you definitely need a
copyright assignment on file:
http://gcc.gnu.org/contribute.html
2- Your change definitely makes sense but not calling _M_clone has
a not-completely-obvious effect: if the string is in the leaked
state it remains leaked, doesn't become sharable. Perhaps you
want to return early only if the string is already sharable?
A leaked string cannot be refcopied and avoiding the _M_clone
call could imply having to call it *many* times later in an
assign, in a constructor or what else...
3- Please, please strive to have a working regtesting setup. It's
important not only to spare us the task (that's not a big deal)
but also when fixing bugs or envisaging large scale changes...
Paolo.
More information about the Libstdc++
mailing list