[libcxx-commits] [libcxx] [libc++] `std::ranges::advance`: avoid unneeded bounds checks when advancing iterator (PR #84126)
Jan Kokemüller via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 2 00:03:07 PDT 2024
================
@@ -188,11 +229,12 @@ constexpr bool test() {
check_forward_sized_sentinel<int*>( range, range+size, n, expected);
}
- {
- // Note that we can only test ranges::advance with a negative n for iterators that
- // are sized sentinels for themselves, because ranges::advance is UB otherwise.
- // In particular, that excludes bidirectional_iterators since those are not sized sentinels.
+ // Exclude the `n == 0` case for the backwards checks.
----------------
jiixyj wrote:
Yep, the `check_backwards` tests also work for the `n == 0` case, as expected.
https://github.com/llvm/llvm-project/pull/84126
More information about the libcxx-commits
mailing list