[Bug libstdc++/19911] Using std::string find the n field always causes nothing to be found

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Feb 12 00:10:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-11 20:46 -------
No string.find (const char *s, size_type pos, size_t n) returns the same as:
string.find(string(s, n), pos)
which means you are allocating a string with length 5 but the string is really 
only of lenght 1 so this will not be able to find the string.

This documented by 21.3.6.1 of the C++ standard.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19911



More information about the Gcc-bugs mailing list