aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include/__iterator/next.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__iterator/next.h')
-rw-r--r--contrib/llvm-project/libcxx/include/__iterator/next.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/llvm-project/libcxx/include/__iterator/next.h b/contrib/llvm-project/libcxx/include/__iterator/next.h
index da60aacfd08d..21d3688ad9eb 100644
--- a/contrib/llvm-project/libcxx/include/__iterator/next.h
+++ b/contrib/llvm-project/libcxx/include/__iterator/next.h
@@ -27,8 +27,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter
next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) {
- _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
- "Attempt to next(it, n) with negative n on a non-bidirectional iterator");
+ // Calling `advance` with a negative value on a non-bidirectional iterator is a no-op in the current implementation.
+ // Note that this check duplicates the similar check in `std::advance`.
+ _LIBCPP_ASSERT_PEDANTIC(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value,
+ "Attempt to next(it, n) with negative n on a non-bidirectional iterator");
std::advance(__x, __n);
return __x;