This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug libstdc++/43634] std::string::replace with C string can replace too many characters



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]