test/util/TestIntrusiveForwardList: implement size() only if options.constant_time_size is set

This commit is contained in:
Max Kellermann 2023-09-13 09:26:02 +02:00 committed by Max Kellermann
parent 175524ad02
commit 6f7dce6dca

View File

@ -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 {