[libcxx-commits] [libcxx] 9563f3b - [libcxx][NFC] adjusts 41b17c44 so it meets requested feedback
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 26 18:11:27 PDT 2021
Author: Christopher Di Bella
Date: 2021-07-27T01:11:04Z
New Revision: 9563f3b571d1dc1f40a546a86c11904b1748ff86
URL: https://github.com/llvm/llvm-project/commit/9563f3b571d1dc1f40a546a86c11904b1748ff86
DIFF: https://github.com/llvm/llvm-project/commit/9563f3b571d1dc1f40a546a86c11904b1748ff86.diff
LOG: [libcxx][NFC] adjusts 41b17c44 so it meets requested feedback
Feedback requested in D106735 applied in Diff 3 seem to have
reverted in Diff 4. This patch fixes that up.
Differential Revision: https://reviews.llvm.org/D106829
Added:
Modified:
libcxx/include/__iterator/advance.h
Removed:
################################################################################
diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h
index 674a3045ba9d..47bce1ddfbe2 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -76,7 +76,7 @@ struct __advance_fn final : private __function_like {
private:
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI
- static constexpr _Tp __magnitude_geq(_Tp __a, _Tp __b) {
+ static constexpr _Tp __magnitude_geq(_Tp __a, _Tp __b) noexcept {
return __a < 0 ? (__a <= __b) : (__a >= __b);
}
@@ -153,12 +153,12 @@ struct __advance_fn final : private __function_like {
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
_LIBCPP_HIDE_FROM_ABI
constexpr iter_
diff erence_t<_Ip> operator()(_Ip& __i, iter_
diff erence_t<_Ip> __n, _Sp __bound) const {
- _LIBCPP_ASSERT((bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>) || (__n >= 0),
+ _LIBCPP_ASSERT((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
"If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
if constexpr (sized_sentinel_for<_Sp, _Ip>) {
// If |n| >= |bound - i|, equivalent to `ranges::advance(i, bound)`.
- if (auto __M = __bound - __i; __magnitude_geq(__n, __M)) {
+ if (const auto __M = __bound - __i; __magnitude_geq(__n, __M)) {
(*this)(__i, __bound);
return __n - __M;
}
More information about the libcxx-commits
mailing list