Replaced checking in string_view::remove_suffix/remove_prefix by _LIBCPP_ASSERT, since this is technically undefined behavior. Fixes PR#21496
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -313,8 +313,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_prefix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
if (__n > __size)
|
||||
__n = __size;
|
||||
_LIBCPP_ASSERT(n <= size(), "remove_prefix() can't remove more than size()");
|
||||
__data += __n;
|
||||
__size -= __n;
|
||||
}
|
||||
@@ -322,8 +321,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
||||
void remove_suffix(size_type __n) _NOEXCEPT
|
||||
{
|
||||
if (__n > __size)
|
||||
__n = __size;
|
||||
_LIBCPP_ASSERT(n <= size(), "remove_suffix() can't remove more than size()");
|
||||
__size -= __n;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user