[libcxx] span: Remove unneeded comparison
authorLouis Dionne <ldionne@apple.com>
Tue, 11 Feb 2020 10:38:00 +0000 (11:38 +0100)
committerLouis Dionne <ldionne@apple.com>
Tue, 11 Feb 2020 10:39:12 +0000 (11:39 +0100)
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

libcxx/include/span

index 119cf39baba93ddea4c95286b6c09c24621a4c63..f18d00c4392846c388f54e1969d61b2e30778818 100644 (file)
@@ -300,7 +300,7 @@ public:
 
     _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 @@ public:
 
     _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];
     }