This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: string::rfind() -- empty strings...


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

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