[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:
@@ -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());
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user