[libcxx-commits] [PATCH] D106829: [libcxx][NFC] adjusts 41b17c44 so it meets requested feedback
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jul 26 18:11:40 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9563f3b571d1: [libcxx][NFC] adjusts 41b17c44 so it meets requested feedback (authored by cjdb).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106829/new/
https://reviews.llvm.org/D106829
Files:
libcxx/include/__iterator/advance.h
Index: libcxx/include/__iterator/advance.h
===================================================================
--- libcxx/include/__iterator/advance.h
+++ libcxx/include/__iterator/advance.h
@@ -76,7 +76,7 @@
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 @@
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
_LIBCPP_HIDE_FROM_ABI
constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106829.361875.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210727/012b83d8/attachment.bin>
More information about the libcxx-commits
mailing list