diff --git a/AK/Variant.h b/AK/Variant.h index 175ec3fdad3..e620df5476c 100644 --- a/AK/Variant.h +++ b/AK/Variant.h @@ -81,22 +81,19 @@ struct Variant { template struct VisitImpl { template - static consteval u64 get_explicitly_named_overload_if_exists() + static consteval bool has_explicitly_named_overload() { // If we're not allowed to make a member function pointer and call it directly (without explicitly resolving it), // we have a templated function on our hands (or a function overload set). // in such cases, we don't have an explicitly named overload, and we would have to select it. - if constexpr (requires { (declval().*(&Fn::operator()))(declval()); }) - return 1ull << I; - - return 0; + return requires { (declval().*(&Fn::operator()))(declval()); }; } template static consteval bool should_invoke_const_overload(IndexSequence) { // Scan over all the different visitor functions, if none of them are suitable for calling with `T const&`, avoid calling that first. - return ((get_explicitly_named_overload_if_exists>()) | ...) != 0; + return ((has_explicitly_named_overload>()) || ...); } template @@ -453,7 +450,6 @@ private: template struct Visitor : Fs... { using Types = TypeList; - static_assert(Types::size < 64, "Variant::visit() can take a maximum of 64 visit functions."); Visitor(Fs&&... args) : Fs(forward(args))...