Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171321 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2012-12-31 20:09:48 +00:00
parent db8a030bd3
commit 352bd3a273
2 changed files with 3 additions and 1 deletions

View File

@ -3374,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
{
const_pointer __p = data();
const_pointer __pe = __p + __sz;
for (const_pointer __ps = __p + __pos; __p != __pe; ++__ps)
for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps)
if (!traits_type::eq(*__ps, __c))
return static_cast<size_type>(__ps - __p);
}

View File

@ -59,6 +59,8 @@ int main()
test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos);
test(S(""), 'q', S::npos);
test(S("q"), 'q', S::npos);
test(S("qqq"), 'q', S::npos);
test(S("csope"), 'q', 0);
test(S("gfsmthlkon"), 'q', 0);
test(S("laenfsbridchgotmkqpj"), 'q', 0);