[libcxx-commits] [libcxx] b4a3e6b - [libcxx] span: Remove unneeded comparison
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 11 02:39:20 PST 2020
Author: Louis Dionne
Date: 2020-02-11T11:39:12+01:00
New Revision: b4a3e6b66428c3eea9271f24b625f4f0f6b30905
URL: https://github.com/llvm/llvm-project/commit/b4a3e6b66428c3eea9271f24b625f4f0f6b30905
DIFF: https://github.com/llvm/llvm-project/commit/b4a3e6b66428c3eea9271f24b625f4f0f6b30905.diff
LOG: [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
Added:
Modified:
libcxx/include/span
Removed:
################################################################################
diff --git a/libcxx/include/span b/libcxx/include/span
index 119cf39baba9..f18d00c43928 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -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];
}
More information about the libcxx-commits
mailing list