[libcxx-commits] [libcxx] [libc++] `std::ranges::advance`: avoid unneeded bounds checks when advancing iterator (PR #84126)
Konstantin Varlamov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 1 16:52:43 PDT 2024
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokemüller?= <jan.kokemueller at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/84126 at github.com>
================
@@ -21,9 +21,12 @@
#include "../types.h"
template <bool Count, typename It>
-constexpr void check_forward(int* first, int* last, std::iter_difference_t<It> n, int* expected) {
+constexpr void check_forward(
+ int* first, int* last, std::iter_difference_t<It> n, int* expected, std::ptrdiff_t expected_equals_count) {
----------------
var-const wrote:
Optional: maybe make `-1` a default value for the parameter instead of passing it explicitly? That way, the magic value is more contained within the implementation of the function and callers don't need to know about it.
https://github.com/llvm/llvm-project/pull/84126
More information about the libcxx-commits
mailing list