#include #include #include #include #include #include namespace extra { template struct TypeInfoExtractor; template struct TypeInfoExtractor { template static void extract(const Func &f) { f(typeid(Head)); TypeInfoExtractor::extract(f); } }; template <> struct TypeInfoExtractor<> { template static void extract(const Func &f) { // nop } }; template struct function_traits; template struct function_traits { static const size_t arity = sizeof...(Params); typedef Return return_type; typedef std::tuple parameter_tuple; template static void extract_type_info(const Func &f) { TypeInfoExtractor::extract(f); } }; } void f(int, int, float, char*, char[10]) { } int main() { typedef extra::function_traits f_traits; f_traits::extract_type_info([] (const std::type_info &rtti) { std::unique_ptr realname(abi::__cxa_demangle(rtti.name(), 0, 0, nullptr), free); std::cout << realname.get() << std::endl; }); }