This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: string::rfind() -- empty strings...
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Re: string::rfind() -- empty strings...
- From: brent verner <brent at rcfile dot org>
- Date: Fri, 23 Jun 2000 16:19:33 -0400
- References: <20000623093414.A16152@rcfile.org>
On 23 Jun 2000 at 09:34 (-0400), brent verner said:
| Following the recent bugfix in basic_string<>::find(..), there is
| a (similar) non-compliant behavior in rfind when the searched for
| string is an empty string. I deduce the following behavior would be
| correct based on the now-compliant behavior of find().
|
| std::string a("str");
| std::string b;
| int pos;
|
| a.find(b,pos);
| //^^^^^^^^^^^ return pos for a.size() < pos => 0, npos otherwise
bzzt! wrong again! I should just quit :)
should have said (since rfind() returns highest position where
matched)...
a.rfind(b,pos);
// ^^^^^^^^^^^ return a.size() for pos < a.size() and pos >= 0
// npos otherwise
Is this now correct? I think so. I'll have a patch shortly.
Brent
--
now-whacking-head-repeatedly