diff --git a/AK/Concepts.h b/AK/Concepts.h index 461f776472..51f1644f98 100644 --- a/AK/Concepts.h +++ b/AK/Concepts.h @@ -129,6 +129,33 @@ concept FallibleFunction = requires(Func&& func, Args&&... args) { func(forward(args)...).release_value(); }; +} +namespace AK::Detail { + +template +inline constexpr bool IsCallableWithArguments = requires(T t) { + { + t(declval()...) + } -> Concepts::ConvertibleTo; +} || requires(T t) { + { + t(declval()...) + } -> Concepts::SameAs; +}; + +} + +namespace AK { + +using Detail::IsCallableWithArguments; + +} + +namespace AK::Concepts { + +template +concept CallableAs = Detail::IsCallableWithArguments; + } #if !USING_AK_GLOBALLY @@ -136,6 +163,7 @@ namespace AK { #endif using AK::Concepts::Arithmetic; using AK::Concepts::ArrayLike; +using AK::Concepts::CallableAs; using AK::Concepts::ConvertibleTo; using AK::Concepts::DerivedFrom; using AK::Concepts::Enum; diff --git a/AK/Function.h b/AK/Function.h index 90ec3c3752..59a97e8346 100644 --- a/AK/Function.h +++ b/AK/Function.h @@ -36,23 +36,6 @@ namespace AK { -namespace Detail { - -template -inline constexpr bool IsCallableWithArguments = requires(T t) { - { - t(declval()...) - } -> ConvertibleTo; -} || requires(T t) { - { - t(declval()...) - } -> SameAs; -}; - -} - -using Detail::IsCallableWithArguments; - template class Function;