1#ifndef MADNESS_FUNCTION_TRAITS
2#define MADNESS_FUNCTION_TRAITS
9 template<
typename>
struct is_type :
public std::true_type { };
12 template <
typename functionT,
typename enablerT =
void>
16 template <
typename functionT,
typename enablerT =
void>
20 template <
typename memfuncT>
24 template <
typename resultT,
typename... argTs>
26 static const bool value =
true;
27 static const int arity =
sizeof...(argTs);
32 template <
typename resultT,
typename... argTs>
34 static const bool value =
true;
35 static const int arity =
sizeof...(argTs);
40 template <
typename fnT,
typename... argTs>
41 struct function_traits<fnT(argTs...),
std::enable_if_t<is_type<std::invoke_result_t<fnT, argTs...>>::value>> {
42 static const bool value =
true;
43 static const int arity =
sizeof...(argTs);
48 template <
typename fnT,
typename... argTs>
49 struct callable_traits<fnT(argTs...),
std::enable_if_t<is_type<std::invoke_result_t<fnT, argTs...>>::value>> {
50 static const bool value =
true;
51 static const int arity =
sizeof...(argTs);
56 template <
typename objT,
typename returnT,
typename... argTs>
58 static const bool value =
true;
59 static const int arity =
sizeof...(argTs);
60 static const bool constness =
false;
66 template <
typename objT,
typename returnT,
typename... argTs>
68 static const bool value =
true;
69 static const int arity =
sizeof...(argTs);
70 static const bool constness =
true;
76 template <
typename fnT,
typename Enabler =
void>
78 typedef char (&
yes)[1];
79 typedef char (&
no)[2];
83 static yes deduce(
char (*)[
sizeof(&U::operator())]);
87 static const bool value =
sizeof(deduce<fnT>(0)) ==
sizeof(
yes);
90 template <
typename fnT>
95 template <
typename fnT,
typename Enabler =
void>
97 typedef typename fnT::result_type
type;
100 template <
typename fnT>
102 public result_of<decltype(&fnT::operator())>
105 template <
typename fnT>
110 template <
typename fnT>
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
std::string type(const PairType &n)
Definition PNOParameters.h:18
std::invoke_result_t< fnT, argTs... > result_type
Definition function_traits.h:52
Function traits in the spirit of boost function traits.
Definition function_traits.h:17
std::invoke_result_t< fnT, argTs... > result_type
Definition function_traits.h:44
resultT result_type
Definition function_traits.h:28
resultT result_type
Definition function_traits.h:36
Function traits in the spirit of boost function traits.
Definition function_traits.h:13
Definition function_traits.h:77
char(& no)[2]
Definition function_traits.h:79
static yes deduce(char(*)[sizeof(&U::operator())])
char(& yes)[1]
Definition function_traits.h:78
static const bool value
Definition function_traits.h:87
Definition function_traits.h:9
returnT result_type
Definition function_traits.h:72
objT obj_type
Definition function_traits.h:71
objT obj_type
Definition function_traits.h:61
returnT result_type
Definition function_traits.h:62
Member function traits in the spirit of boost function traits.
Definition function_traits.h:21
function_traits< fnT >::result_type type
Definition function_traits.h:107
memfunc_traits< fnT >::result_type type
Definition function_traits.h:112
Definition function_traits.h:96
fnT::result_type type
Definition function_traits.h:97