From 6f7dce6dcafaa6749eb0b994eee5e31b93822c2b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Sep 2023 09:26:02 +0200 Subject: [PATCH] test/util/TestIntrusiveForwardList: implement size() only if `options.constant_time_size` is set --- src/util/IntrusiveForwardList.hxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/util/IntrusiveForwardList.hxx b/src/util/IntrusiveForwardList.hxx index 39055f11c..ea105b591 100644 --- a/src/util/IntrusiveForwardList.hxx +++ b/src/util/IntrusiveForwardList.hxx @@ -178,11 +178,9 @@ public: return head.next == nullptr; } - constexpr size_type size() const noexcept { - if constexpr (constant_time_size) - return counter; - else - return std::distance(begin(), end()); + constexpr size_type size() const noexcept + requires(constant_time_size) { + return counter; } void clear() noexcept {