[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:55 PDT 2024
================
@@ -42,6 +42,18 @@ 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) {
----------------
jiixyj wrote:
Agreed, I like it better as well :)
https://github.com/llvm/llvm-project/pull/84126
More information about the libcxx-commits
mailing list