This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/23494] std::basic_string <> capacity weirdness
- From: "pogonyshev at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Aug 2005 18:48:54 -0000
- Subject: [Bug libstdc++/23494] std::basic_string <> capacity weirdness
- References: <20050820162237.23494.pogonyshev@gmx.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pogonyshev at gmx dot net 2005-08-20 18:48 -------
Because it defeats the effect of reserve() call on `s1'. I'm not saying I know
how to avoid it, but I wonder if there is some strict policy behind
`std::basic_string' reallocation behavior in GNU STL. Maybe this example shows
that the policy is not implemented properly.
I think this example shows a perfectly common usage of strings where you reserve
space for all the things you are going to stuff in the string and then make a
copy of an intermediate results. With current GNU STL behavior, this doesn't
work as expected, though, of course, it *will* give the correct result, it is
only about optimizations.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23494