This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/19911] Using std::string find the n field always causes nothing to be found
- From: "grogers at cray dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Feb 2005 20:59:17 -0000
- Subject: [Bug libstdc++/19911] Using std::string find the n field always causes nothing to be found
- References: <20050211203154.19911.grogers@cray.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From grogers at cray dot com 2005-02-11 20:59 -------
Subject: Re: Using std::string find the n field always
causes nothing to be found
Okay, doesn't make much sense.
The docs I found on the web all had it described as n being the number
of characters past pos to search.
pinskia at gcc dot gnu dot org wrote:
> ------- 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.
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19911