diff --git a/src/util/IntrusiveHashSet.hxx b/src/util/IntrusiveHashSet.hxx index 25e929961..4ca132afe 100644 --- a/src/util/IntrusiveHashSet.hxx +++ b/src/util/IntrusiveHashSet.hxx @@ -11,6 +11,21 @@ #include // for std::regular_invocable #include // for std::accumulate() +template +concept IntrusiveHashSetOperatorsConcept = requires(const Operators &ops, + const Item &c, const Item &c2) +{ + { ops.get_key(c) } noexcept; + + /* note: no "noexcept" here because std::hash is not + noexcept */ + { ops.hash(ops.get_key(c)) } -> std::same_as; + + /* note: no "noexcept" here because std::equal_to is not + noexcept */ + { ops.equal(ops.get_key(c), ops.get_key(c2)) } -> std::same_as; +}; + struct IntrusiveHashSetOptions { bool constant_time_size = false; @@ -123,7 +138,7 @@ struct IntrusiveHashSetOperators { * `equal` */ template Operators, typename HookTraits=IntrusiveHashSetBaseHookTraits, IntrusiveHashSetOptions options=IntrusiveHashSetOptions{}> class IntrusiveHashSet {