30 #ifndef LIB_TEST_MICROBENCHMARK_ADAPTOR_H 31 #define LIB_TEST_MICROBENCHMARK_ADAPTOR_H 39 namespace microbenchmark {
42 using std::is_arithmetic;
52 template<
class SIG,
typename SEL=
void>
55 static_assert (not
sizeof(SIG),
"Unable to adapt given functor.");
61 template<
typename FUN>
65 return std::forward<FUN>(fun);
72 template<
typename FUN>
76 return [functor=std::forward<FUN>(fun)]
85 template<
typename ON,
typename IN>
86 struct Adaptor<ON(IN), enable_if<__and_<is_arithmetic<IN>, __not_<is_same<IN,size_t>>
87 ,is_arithmetic<ON>, __not_<is_same<ON,size_t>>
90 template<
typename FUN>
94 return [functor=std::forward<FUN>(fun)]
97 return size_t(functor(i));
102 template<
typename ON>
103 struct Adaptor<ON(void), enable_if<__and_<is_arithmetic<ON>, __not_<is_same<ON,size_t>>
106 template<
typename FUN>
110 return [functor=std::forward<FUN>(fun)]
113 return size_t(functor());
118 template<
typename IN>
119 struct Adaptor<void(IN), enable_if<__and_<is_arithmetic<IN>, __not_<is_same<IN,size_t>>
122 template<
typename FUN>
126 return [functor=std::forward<FUN>(fun)]
147 template<
typename FUN>
148 inline decltype(
auto)
149 adapted4benchmark (FUN&& fun)
Implementation namespace for support and library code.
Metaprogramming tools for transforming functor types.