This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
It does seem to me that previous versions of reserve() could return with the string still in the leaked state, though, if the method decided that no call to _M_clone() was necessary.
Indeed, but in that case you didn't pay the price of _S_create inside _M_clone, so... probably a good trade-off: the string doesn't become sharable but we don't spend time copying it either...
Sorry for a little bit of confusion here: what I really mean is that, probably, irrespective of the details of your change, we should remember to _always_ call _M_set_sharable() before leaving reserve, since this is allowed by the standard and by definition a sharable string can be quickly refcopied.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |