[libc++] Add `noexcept` to `string::find` and similar members.

Adds `noexcept` to `string_view`/`string::find` and similar members
(`rfind`, etc.). See discussion in D95251. Refs D95821.

Reviewed By: curdeius, ldionne

Differential Revision: https://reviews.llvm.org/D95848
This commit is contained in:
zoecarver 2021-02-05 11:54:47 -08:00
parent 59c1139d3e
commit dea74b2820
60 changed files with 139 additions and 46 deletions

View File

@ -953,7 +953,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
template <class _CharT, class _Traits>
inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT *
__search_substring(const _CharT *__first1, const _CharT *__last1,
const _CharT *__first2, const _CharT *__last2) {
const _CharT *__first2, const _CharT *__last2) _NOEXCEPT {
// Take advantage of knowing source and pattern lengths.
// Stop short when source is smaller than pattern.
const ptrdiff_t __len2 = __last2 - __first2;

View File

@ -262,49 +262,49 @@ public:
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
template <class T>
size_type find(const T& t, size_type pos = 0) const; // C++17
size_type find(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
size_type find(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find(const value_type* s, size_type pos = 0) const noexcept;
size_type find(value_type c, size_type pos = 0) const noexcept;
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
template <class T>
size_type rfind(const T& t, size_type pos = npos) const; // C++17
size_type rfind(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension
size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept;
size_type rfind(const value_type* s, size_type pos = npos) const noexcept;
size_type rfind(value_type c, size_type pos = npos) const noexcept;
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
template <class T>
size_type find_first_of(const T& t, size_type pos = 0) const; // C++17
size_type find_first_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
size_type find_first_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_first_of(const value_type* s, size_type pos = 0) const noexcept;
size_type find_first_of(value_type c, size_type pos = 0) const noexcept;
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
template <class T>
size_type find_last_of(const T& t, size_type pos = npos) const noexcept; // C++17
size_type find_last_of(const T& t, size_type pos = npos) const noexcept noexcept; // C++17, noexcept as an extension
size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept;
size_type find_last_of(value_type c, size_type pos = npos) const noexcept;
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
template <class T>
size_type find_first_not_of(const T& t, size_type pos = 0) const; // C++17
size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept; // C++17, noexcept as an extension
size_type find_first_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_first_not_of(const value_type* s, size_type pos = 0) const noexcept;
size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept;
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
template <class T>
size_type find_last_not_of(const T& t, size_type pos = npos) const; // C++17
size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept; // C++17, noexcept as an extension
size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept;
size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept;
size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept;
int compare(const basic_string& str) const noexcept;
template <class T>
int compare(const T& t) const noexcept; // C++17
int compare(const T& t) const noexcept; // C++17, noexcept as an extension
int compare(size_type pos1, size_type n1, const basic_string& str) const;
template <class T>
int compare(size_type pos1, size_type n1, const T& t) const; // C++17
@ -1284,7 +1284,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find(const _Tp& __t, size_type __pos = 0) const;
find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
@ -1300,7 +1300,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
rfind(const _Tp& __t, size_type __pos = npos) const;
rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
@ -1316,7 +1316,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_first_of(const _Tp& __t, size_type __pos = 0) const;
find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT;
size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
@ -1333,7 +1333,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_last_of(const _Tp& __t, size_type __pos = npos) const;
find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
@ -1350,7 +1350,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_first_not_of(const _Tp &__t, size_type __pos = 0) const;
find_first_not_of(const _Tp &__t, size_type __pos = 0) const _NOEXCEPT;
size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const value_type* __s, size_type __pos = 0) const _NOEXCEPT;
@ -1367,7 +1367,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
size_type
>
find_last_not_of(const _Tp& __t, size_type __pos = npos) const;
find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT;
size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT;
@ -1384,7 +1384,7 @@ public:
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
int
>
compare(const _Tp &__t) const;
compare(const _Tp &__t) const _NOEXCEPT;
template <class _Tp>
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
@ -3543,7 +3543,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_find<value_type, size_type, traits_type, npos>
@ -3601,7 +3601,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_rfind<value_type, size_type, traits_type, npos>
@ -3659,7 +3659,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_find_first_of<value_type, size_type, traits_type, npos>
@ -3717,7 +3717,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_find_last_of<value_type, size_type, traits_type, npos>
@ -3775,7 +3775,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_find_first_not_of<value_type, size_type, traits_type, npos>
@ -3834,7 +3834,7 @@ _EnableIf
typename basic_string<_CharT, _Traits, _Allocator>::size_type
>
basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t,
size_type __pos) const
size_type __pos) const _NOEXCEPT
{
__self_view __sv = __t;
return __str_find_last_not_of<value_type, size_type, traits_type, npos>
@ -3871,7 +3871,7 @@ _EnableIf
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
int
>
basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const
basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT
{
__self_view __sv = __t;
size_t __lhs_sz = size();

View File

@ -119,28 +119,28 @@ namespace std {
const charT* s, size_type n2) const;
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
constexpr size_type find(const charT* s, size_type pos, size_type n) const;
constexpr size_type find(const charT* s, size_type pos = 0) const;
constexpr size_type find(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type find(const charT* s, size_type pos = 0) const noexcept; // noexcept as an extension
constexpr size_type rfind(basic_string_view s, size_type pos = npos) const noexcept;
constexpr size_type rfind(charT c, size_type pos = npos) const noexcept;
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const;
constexpr size_type rfind(const charT* s, size_type pos = npos) const;
constexpr size_type rfind(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type rfind(const charT* s, size_type pos = npos) const noexcept; // noexcept as an extension
constexpr size_type find_first_of(basic_string_view s, size_type pos = 0) const noexcept;
constexpr size_type find_first_of(charT c, size_type pos = 0) const noexcept;
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const;
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const;
constexpr size_type find_first_of(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type find_first_of(const charT* s, size_type pos = 0) const noexcept; // noexcept as an extension
constexpr size_type find_last_of(basic_string_view s, size_type pos = npos) const noexcept;
constexpr size_type find_last_of(charT c, size_type pos = npos) const noexcept;
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const;
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const;
constexpr size_type find_last_of(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type find_last_of(const charT* s, size_type pos = npos) const noexcept; // noexcept as an extension
constexpr size_type find_first_not_of(basic_string_view s, size_type pos = 0) const noexcept;
constexpr size_type find_first_not_of(charT c, size_type pos = 0) const noexcept;
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const;
constexpr size_type find_first_not_of(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type find_first_not_of(const charT* s, size_type pos = 0) const noexcept; // noexcept as an extension
constexpr size_type find_last_not_of(basic_string_view s, size_type pos = npos) const noexcept;
constexpr size_type find_last_not_of(charT c, size_type pos = npos) const noexcept;
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const;
constexpr size_type find_last_not_of(const charT* s, size_type pos, size_type n) const noexcept; // noexcept as an extension
constexpr size_type find_last_not_of(const charT* s, size_type pos = npos) const noexcept; // noexcept as an extension
constexpr bool starts_with(basic_string_view s) const noexcept; // C++20
constexpr bool starts_with(charT c) const noexcept; // C++20
@ -431,7 +431,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find(const _CharT* __s, size_type __pos, size_type __n) const
size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr");
return __str_find<value_type, size_type, traits_type, npos>
@ -439,7 +439,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find(const _CharT* __s, size_type __pos = 0) const
size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr");
return __str_find<value_type, size_type, traits_type, npos>
@ -463,7 +463,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const
size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr");
return __str_rfind<value_type, size_type, traits_type, npos>
@ -471,7 +471,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type rfind(const _CharT* __s, size_type __pos=npos) const
size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr");
return __str_rfind<value_type, size_type, traits_type, npos>
@ -492,7 +492,7 @@ public:
{ return find(__c, __pos); }
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr");
return __str_find_first_of<value_type, size_type, traits_type, npos>
@ -500,7 +500,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const _CharT* __s, size_type __pos=0) const
size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr");
return __str_find_first_of<value_type, size_type, traits_type, npos>
@ -521,7 +521,7 @@ public:
{ return rfind(__c, __pos); }
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr");
return __str_find_last_of<value_type, size_type, traits_type, npos>
@ -529,7 +529,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const
size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr");
return __str_find_last_of<value_type, size_type, traits_type, npos>
@ -553,7 +553,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr");
return __str_find_first_not_of<value_type, size_type, traits_type, npos>
@ -561,7 +561,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const
size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr");
return __str_find_first_not_of<value_type, size_type, traits_type, npos>
@ -585,7 +585,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr");
return __str_find_last_not_of<value_type, size_type, traits_type, npos>
@ -593,7 +593,7 @@ public:
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const
size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT
{
_LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr");
return __str_find_last_not_of<value_type, size_type, traits_type, npos>

View File

@ -29,6 +29,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, int x)
{
LIBCPP_ASSERT_NOEXCEPT(s.compare(str));
assert(sign(s.compare(str)) == sign(x));
}

View File

@ -29,6 +29,7 @@ template <class S>
void
test(const S& s, const S& str, int x)
{
LIBCPP_ASSERT_NOEXCEPT(s.compare(str));
assert(sign(s.compare(str)) == sign(x));
}

View File

@ -29,6 +29,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, int x)
{
LIBCPP_ASSERT_NOEXCEPT(s.compare(sv));
assert(sign(s.compare(sv)) == sign(x));
}

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(c, pos));
assert(s.find_first_not_of(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(c));
assert(s.find_first_not_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos));
assert(s.find_first_not_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos, n));
assert(s.find_first_not_of(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos));
assert(s.find_first_not_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str));
assert(s.find_first_not_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(sv, pos));
assert(s.find_first_not_of(sv, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(sv));
assert(s.find_first_not_of(sv) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(c, pos));
assert(s.find_first_of(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(c));
assert(s.find_first_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos));
assert(s.find_first_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str));
assert(s.find_first_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos, n));
assert(s.find_first_of(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos));
assert(s.find_first_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str));
assert(s.find_first_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(sv, pos));
assert(s.find_first_of(sv, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(sv));
assert(s.find_first_of(sv) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(c, pos));
assert(s.find_last_not_of(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(c));
assert(s.find_last_not_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos));
assert(s.find_last_not_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str));
assert(s.find_last_not_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos, n));
assert(s.find_last_not_of(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos));
assert(s.find_last_not_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str));
assert(s.find_last_not_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(sv, pos));
assert(s.find_last_not_of(sv, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(sv));
assert(s.find_last_not_of(sv) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(c, pos));
assert(s.find_last_of(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(c));
assert(s.find_last_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos));
assert(s.find_last_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str));
assert(s.find_last_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos, n));
assert(s.find_last_of(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos));
assert(s.find_last_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str));
assert(s.find_last_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(sv, pos));
assert(s.find_last_of(sv, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(sv));
assert(s.find_last_of(sv) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(c, pos));
assert(s.find(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x + 1 <= s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(c));
assert(s.find(c) == x);
if (x != S::npos)
assert(0 <= x && x + 1 <= s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos));
assert(s.find(str, pos) == x);
if (x != S::npos)
{
@ -33,6 +34,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str));
assert(s.find(str) == x);
if (x != S::npos)
{

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos, n));
assert(s.find(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x + n <= s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos));
assert(s.find(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x + str.size() <= s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str));
assert(s.find(str) == x);
if (x != S::npos)
assert(0 <= x && x + str.size() <= s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(sv, pos));
assert(s.find(sv, pos) == x);
if (x != S::npos)
assert(pos <= x && x + sv.size() <= s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(sv));
assert(s.find(sv) == x);
if (x != S::npos)
assert(0 <= x && x + sv.size() <= s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(c, pos));
assert(s.rfind(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x + 1 <= s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(c));
assert(s.rfind(c) == x);
if (x != S::npos)
assert(x + 1 <= s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos));
assert(s.rfind(str, pos) == x);
if (x != S::npos)
{
@ -33,6 +34,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str));
assert(s.rfind(str) == x);
if (x != S::npos)
{

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos, n));
assert(s.rfind(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x + n <= s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos));
assert(s.rfind(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x + str.size() <= s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str));
assert(s.rfind(str) == x);
if (x != S::npos)
assert(0 <= x && x + str.size() <= s.size());

View File

@ -20,6 +20,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(sv, pos));
assert(s.rfind(sv, pos) == x);
if (x != S::npos)
assert(x <= pos && x + sv.size() <= s.size());
@ -29,6 +30,7 @@ template <class S, class SV>
void
test(const S& s, SV sv, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(sv));
assert(s.rfind(sv) == x);
if (x != S::npos)
assert(0 <= x && x + sv.size() <= s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(c, pos));
assert(s.find(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x + 1 <= s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(c, pos));
assert(s.find_first_not_of(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(c));
assert(s.find_first_not_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos));
assert(s.find_first_not_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos, n));
assert(s.find_first_not_of(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -19,6 +19,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_not_of(str, pos));
assert(s.find_first_not_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(c, pos));
assert(s.find_first_of(c, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos));
assert(s.find_first_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str));
assert(s.find_first_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos, n));
assert(s.find_first_of(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());

View File

@ -19,6 +19,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str, pos));
assert(s.find_first_of(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x < s.size());
@ -28,6 +29,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_first_of(str));
assert(s.find_first_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(c, pos));
assert(s.find_last_not_of(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(c));
assert(s.find_last_not_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos));
assert(s.find_last_not_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos, n));
assert(s.find_last_not_of(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());

View File

@ -19,6 +19,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str, pos));
assert(s.find_last_not_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -28,6 +29,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_not_of(str));
assert(s.find_last_not_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(c, pos));
assert(s.find_last_of(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(c));
assert(s.find_last_of(c) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos));
assert(s.find_last_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -30,6 +31,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str));
assert(s.find_last_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos, n));
assert(s.find_last_of(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());

View File

@ -19,6 +19,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str, pos));
assert(s.find_last_of(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x < s.size());
@ -28,6 +29,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find_last_of(str));
assert(s.find_last_of(str) == x);
if (x != S::npos)
assert(x < s.size());

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos));
assert(s.find(str, pos) == x);
if (x != S::npos)
{
@ -33,6 +34,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str));
assert(s.find(str) == x);
if (x != S::npos)
{

View File

@ -21,6 +21,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos, n));
assert(s.find(str, pos, n) == x);
if (x != S::npos)
assert(pos <= x && x + n <= s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str, pos));
assert(s.find(str, pos) == x);
if (x != S::npos)
assert(pos <= x && x + str.size() <= s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.find(str));
assert(s.find(str) == x);
if (x != S::npos)
assert(0 <= x && x + str.size() <= s.size());

View File

@ -20,6 +20,7 @@ void
test(const S& s, typename S::value_type c, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(c, pos));
assert(s.rfind(c, pos) == x);
if (x != S::npos)
assert(x <= pos && x + 1 <= s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, typename S::value_type c, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(c));
assert(s.rfind(c) == x);
if (x != S::npos)
assert(x + 1 <= s.size());

View File

@ -20,6 +20,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos));
assert(s.rfind(str, pos) == x);
if (x != S::npos)
{
@ -32,6 +33,7 @@ template <class S>
void
test(const S& s, const typename S::value_type* str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str));
assert(s.rfind(str) == x);
if (x != S::npos)
{

View File

@ -20,6 +20,7 @@ void
test(const S& s, const typename S::value_type* str, typename S::size_type pos,
typename S::size_type n, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos, n));
assert(s.rfind(str, pos, n) == x);
if (x != S::npos)
assert(x <= pos && x + n <= s.size());

View File

@ -20,6 +20,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type pos, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str, pos));
assert(s.rfind(str, pos) == x);
if (x != S::npos)
assert(x <= pos && x + str.size() <= s.size());
@ -29,6 +30,7 @@ template <class S>
void
test(const S& s, const S& str, typename S::size_type x)
{
LIBCPP_ASSERT_NOEXCEPT(s.rfind(str));
assert(s.rfind(str) == x);
if (x != S::npos)
assert(0 <= x && x + str.size() <= s.size());