39 #ifndef LIB_TEST_MICROBENCHMARK_ADAPTOR_H 40 #define LIB_TEST_MICROBENCHMARK_ADAPTOR_H 48 namespace microbenchmark {
51 using std::is_arithmetic;
61 template<
class SIG,
typename SEL=
void>
64 static_assert (not
sizeof(SIG),
"Unable to adapt given functor.");
70 template<
typename FUN>
74 return std::forward<FUN>(fun);
81 template<
typename FUN>
85 return [functor=std::forward<FUN>(fun)]
94 template<
typename ON,
typename IN>
95 struct Adaptor<ON(IN), enable_if<__and_<is_arithmetic<IN>, __not_<is_same<IN,size_t>>
96 ,is_arithmetic<ON>, __not_<is_same<ON,size_t>>
99 template<
typename FUN>
103 return [functor=std::forward<FUN>(fun)]
106 return size_t(functor(i));
111 template<
typename ON>
112 struct Adaptor<ON(void), enable_if<__and_<is_arithmetic<ON>, __not_<is_same<ON,size_t>>
115 template<
typename FUN>
119 return [functor=std::forward<FUN>(fun)]
122 return size_t(functor());
127 template<
typename IN>
128 struct Adaptor<void(IN), enable_if<__and_<is_arithmetic<IN>, __not_<is_same<IN,size_t>>
131 template<
typename FUN>
135 return [functor=std::forward<FUN>(fun)]
156 template<
typename FUN>
157 inline decltype(
auto)
158 adapted4benchmark (FUN&& fun)
Implementation namespace for support and library code.
Metaprogramming tools for transforming functor types.