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:
Marshall Clow
2014-11-11 22:07:10 +00:00
parent 3f5579f0b2
commit 1cf810b81b
3 changed files with 6 additions and 14 deletions

View File

@@ -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;
}