[libcxx] span: Remove unneeded comparison
size_t is always greater than 0, so remove the artifact from the old
index_type.
Patch by Michael Schellenberger Costa.
Differential Revision: https://reviews.llvm.org/D71996
diff --git a/libcxx/include/span b/libcxx/include/span
index 119cf39..f18d00c 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -300,7 +300,7 @@
_LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
{
- _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T,N>[] index out of bounds");
+ _LIBCPP_ASSERT(__idx < size(), "span<T,N>[] index out of bounds");
return __data[__idx];
}
@@ -469,7 +469,7 @@
_LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
{
- _LIBCPP_ASSERT(__idx >= 0 && __idx < size(), "span<T>[] index out of bounds");
+ _LIBCPP_ASSERT(__idx < size(), "span<T>[] index out of bounds");
return __data[__idx];
}