21 #ifndef GRPPI_COMMON_CALLABLE_TRAITS_H 22 #define GRPPI_COMMON_CALLABLE_TRAITS_H 24 #include <type_traits> 42 template <
typename R,
typename ... Args>
45 using arity =
typename std::integral_constant<size_t,
sizeof...(Args)>::
type;
50 template <
typename R,
typename ... Args>
56 template <
typename C,
typename R,
typename ... Args>
62 template <
typename C,
typename R,
typename ... Args>
80 return std::is_same<void,
81 typename std::result_of<G()>::type
85 template <
typename F,
typename I>
87 return std::is_same<void,
88 typename std::result_of<F(I)>::type
102 template <
typename F,
typename I>
106 template <
typename G>
108 !internal::has_void_return<G>();
111 template <
typename G>
113 typename std::enable_if_t<is_generator<G>,
int>;
117 template <
typename F>
119 typename std::enable_if_t<internal::has_arguments<F>(),
int>;
122 template <
typename F,
typename I>
124 typename std::enable_if_t<internal::has_void_return<F(I)>(),
int>;
typename std::enable_if_t< internal::has_void_return< F(I)>(), int > requires_consumer
Definition: callable_traits.h:124
Definition: callable_traits.h:26
typename std::enable_if_t< internal::has_arguments< F >(), int > requires_arguments
Definition: callable_traits.h:119
constexpr bool is_consumer
Definition: callable_traits.h:103
constexpr bool has_void_return()
Definition: callable_traits.h:79
constexpr size_t callable_arity()
Definition: callable_traits.h:73
Definition: callable_traits.h:38
Definition: callable_traits.h:68
constexpr bool is_generator
Definition: callable_traits.h:107
Identity type trait.
Definition: callable_traits.h:32
typename std::integral_constant< size_t, sizeof...(Args)>::type arity
Definition: callable_traits.h:45
R(Args...) type
Definition: callable_traits.h:33
typename std::enable_if_t< is_generator< G >, int > requires_generator
Definition: callable_traits.h:113
constexpr bool has_arguments()
Definition: callable_traits.h:94