16 #ifndef GRPPI_COMMON_CALLABLE_TRAITS_H
17 #define GRPPI_COMMON_CALLABLE_TRAITS_H
19 #include <type_traits>
37 template <
typename R,
typename ... Args>
40 using arity =
typename std::integral_constant<size_t,
sizeof...(Args)>::
type;
45 template <
typename R,
typename ... Args>
51 template <
typename C,
typename R,
typename ... Args>
57 template <
typename C,
typename R,
typename ... Args>
75 return std::is_same<void,
76 typename std::result_of<G()>::type
80 template <
typename F,
typename I>
82 return std::is_same<void,
83 typename std::result_of<F(I)>::type
97 template <
typename F,
typename I>
98 constexpr
bool is_consumer = internal::has_void_return<F,I>();
101 template <
typename G>
103 !internal::has_void_return<G>();
106 template <
typename G>
108 typename std::enable_if_t<is_generator<G>,
int>;
112 template <
typename F>
114 typename std::enable_if_t<internal::has_arguments<F>(),
int>;
117 template <
typename F,
typename I>
119 typename std::enable_if_t<internal::has_void_return<F(I)>(),
int>;
constexpr size_t callable_arity()
Definition: callable_traits.h:68
constexpr bool has_void_return()
Definition: callable_traits.h:74
constexpr bool has_arguments()
Definition: callable_traits.h:89
Definition: callable_traits.h:21
typename std::enable_if_t< internal::has_void_return< F(I)>(), int > requires_consumer
Definition: callable_traits.h:119
typename std::enable_if_t< is_generator< G >, int > requires_generator
Definition: callable_traits.h:108
constexpr bool is_generator
Definition: callable_traits.h:102
constexpr bool is_consumer
Definition: callable_traits.h:98
typename std::enable_if_t< internal::has_arguments< F >(), int > requires_arguments
Definition: callable_traits.h:114
typename std::integral_constant< size_t, sizeof...(Args)>::type arity
Definition: callable_traits.h:40
Definition: callable_traits.h:34
Definition: callable_traits.h:64
Identity type trait.
Definition: callable_traits.h:27
T type
Definition: callable_traits.h:28