1 #ifndef SIPLASPLAS_UTILITY_FUNCTION_TRAITS_HPP 2 #define SIPLASPLAS_UTILITY_FUNCTION_TRAITS_HPP 6 #include <ctti/type_id.hpp> 11 enum class FunctionKind
17 CONST_MEMBER_FUNCTION,
31 static std::true_type check(decltype(&U::operator(),
nullptr));
33 static std::false_type check(...);
35 static constexpr
bool value = decltype(check<T>(
nullptr))::value;
38 template<
typename Function>
42 static constexpr FunctionKind kind = FunctionKind::INVALID;
45 template<
typename R,
typename... Args>
50 using return_type = R;
52 static constexpr FunctionKind kind = FunctionKind::FREE_FUNCTION;
55 template<
typename R,
typename... Args>
60 template<
typename C,
typename R,
typename... Args>
65 using return_type = R;
66 static constexpr FunctionKind kind = FunctionKind::MEMBER_FUNCTION;
69 template<
typename C,
typename R,
typename... Args>
74 using return_type = R;
75 static constexpr FunctionKind kind = FunctionKind::CONST_MEMBER_FUNCTION;
82 template<
typename T,
typename Class>
87 using return_type = T;
88 static constexpr FunctionKind kind = FunctionKind::MEMBER_OBJECT;
92 template<typename Function, bool IsFunctor = detail::IsFunctorClass<Function>::value>
97 template<
typename Functor>
103 using args = meta::tail_t<
106 using args_without_this = args;
109 static constexpr FunctionKind kind = FunctionKind::FUNCTOR;
112 template<
typename Function>
115 template<
typename Function>
118 template<
typename Function>
121 template<std::
size_t Index,
typename Function>
122 using function_argument = meta::get_t<Index, function_arguments<Function>>;
124 template<
typename Function>
125 constexpr FunctionKind function_kind()
130 template<
typename Function>
131 constexpr FunctionKind function_kind(
Function)
133 return function_kind<Function>();
136 template<
typename A,
typename B>
138 function_arguments_without_this<A>, function_arguments_without_this<B>
143 #endif // SIPLASPLAS_UTILITY_FUNCTION_TRAITS_HPP Definition: messaging.hpp:8
Definition: function_traits.hpp:39
Definition: function_traits.hpp:28
Definition: function_traits.hpp:93
Definition: test_util.hpp:13
Definition: function.hpp:14
Definition: astexamples.hpp:2
Definition: function_traits.hpp:137