This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/43634] std::string::replace with C string can replace too many characters
- From: "poftwaresatent at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Apr 2010 01:38:34 -0000
- Subject: [Bug libstdc++/43634] std::string::replace with C string can replace too many characters
- References: <bug-43634-17772@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from poftwaresatent at gmail dot com 2010-04-03 01:38 -------
So, looks more like a documentation issue then, fine by me.
Quote from basic_string.h: "Removes the characters in the range [pos,pos + n1)
from this string. In place, the first @a n characters of @a s are inserted."
I interpreted that as meaning "when s is longer than n, just use the first n
characters of it and disregards whatever follows." Similarly, Josuttis (pg 519
of 10th printing) says: "Both forms replace, at most, len characters of
*this..."
Thanks for the quick reply!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43634