http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
Bug #: 52938
Summary: std::string::reserve request is not maintained if
object is used in other object copy ctore
Classification: Unclassified
Product: gcc
Version: 4.6.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
--- Comment #2 from Abdul Tohmaz 2012-04-11
20:32:26 UTC ---
(In reply to comment #1)
> Why do you think this is a bug? I don't see why x="aaa"; would not change the
> reserve.
>
> The main reason why it changes the reserve is that the backin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
--- Comment #6 from Abdul Tohmaz 2012-04-11
23:50:21 UTC ---
Guys, I do value your points, but please consider the following:
I can't always be in control when a copy is made of my string. Here is a quick
example.
string x;
x.reserve(1024); //n
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
Abdul Tohmaz changed:
What|Removed |Added
Status|RESOLVED|UNCONFIRMED
Resolution|WONTFIX
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
--- Comment #10 from Abdul Tohmaz 2012-04-12
00:11:34 UTC ---
Thanks for the clarification,
I will switch to ext/vstring.h...
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
--- Comment #12 from Abdul Tohmaz 2012-04-12
23:07:32 UTC ---
(In reply to comment #11)
> The benefits and problems of reference-counted strings are well known and it's
> not going to be changed now, std::string is stable and effectively frozen
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52938
--- Comment #14 from Abdul Tohmaz 2012-04-13
13:37:47 UTC ---
(In reply to comment #13)
> Immediately after you call reserve it returns at least 1024. But not
> necessarily from that point on for ever and ever. If you call swap() to
> exchange