#ifndef SRC_UTIL_FUNCTION_TRAITS_H_ #define SRC_UTIL_FUNCTION_TRAITS_H_ #include #include namespace toolkit { template struct function_traits; //普通函数 [AUTO-TRANSLATED:569a9de3] //Ordinary function template struct function_traits { public: static constexpr size_t arity = sizeof...(Args); using function_type = Ret(Args...); using return_type = Ret; using stl_function_type = std::function; using pointer = Ret(*)(Args...); template struct args { static_assert(I < arity, "index is out of range, index must less than sizeof Args"); using type = typename std::tuple_element >::type; }; }; //函数指针 [AUTO-TRANSLATED:bc15033e] //Function pointer template struct function_traits : function_traits{}; //std::function template struct function_traits> : function_traits{}; //member function #define FUNCTION_TRAITS(...) \ template \ struct function_traits : function_traits{}; \ FUNCTION_TRAITS() FUNCTION_TRAITS(const) FUNCTION_TRAITS(volatile) FUNCTION_TRAITS(const volatile) //函数对象 [AUTO-TRANSLATED:a0091563] //Function object template struct function_traits : function_traits{}; } /* namespace toolkit */ #endif /* SRC_UTIL_FUNCTION_TRAITS_H_ */