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

brent verner brent@rcfile.org
Fri Jun 23 06:34:00 GMT 2000


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

I'll have a patch as well as a test case for this sometime after work 
today. If the behavior described is incorrect, stop me before I f@#$ 
it up :)

Cheers.
  Brent

-- 
Damon Brent Verner
Cracker Jack® Certified Professional
brent@rcfile.org, brent@linux1.org


More information about the Libstdc++ mailing list