[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 Mar 19 11:33:19 PDT 2024
================
@@ -42,6 +42,13 @@ constexpr void check_forward(int* first, int* last, std::iter_difference_t<It> n
// regardless of the iterator category.
assert(it.stride_count() == M);
assert(it.stride_displacement() == M);
+ if (n == 0) {
+ assert(it.equals_count() == 0);
+ } else {
+ assert(it.equals_count() > 0);
----------------
jiixyj wrote:
Yes, I think you're right! I removed this check.
https://github.com/llvm/llvm-project/pull/84126
More information about the libcxx-commits
mailing list