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:
parent
db8a030bd3
commit
352bd3a273
@ -3374,7 +3374,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
|
|||||||
{
|
{
|
||||||
const_pointer __p = data();
|
const_pointer __p = data();
|
||||||
const_pointer __pe = __p + __sz;
|
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))
|
if (!traits_type::eq(*__ps, __c))
|
||||||
return static_cast<size_type>(__ps - __p);
|
return static_cast<size_type>(__ps - __p);
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ int main()
|
|||||||
test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos);
|
test(S("oselktgbcapndfjihrmq"), 'q', 21, S::npos);
|
||||||
|
|
||||||
test(S(""), 'q', 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("csope"), 'q', 0);
|
||||||
test(S("gfsmthlkon"), 'q', 0);
|
test(S("gfsmthlkon"), 'q', 0);
|
||||||
test(S("laenfsbridchgotmkqpj"), 'q', 0);
|
test(S("laenfsbridchgotmkqpj"), 'q', 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user