[libcxx-commits] [PATCH] D71996: [libcxx] span: Remove unneeded comparison
Michael Schellenberger Costa via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 30 05:17:25 PST 2019
miscco created this revision.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, ldionne, christof.
Herald added a project: libc++.
size_t is always greater than 0 so remove the artifact from the old index_type
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71996
Files:
libcxx/include/span
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/include/span
@@ -301,7 +301,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];
}
@@ -470,7 +470,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>::operator[] index out of bounds");
return __data[__idx];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71996.235583.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191230/e0058142/attachment.bin>
More information about the libcxx-commits
mailing list