#ifndef NETWORKIT_AUXILIARY_FUNCTION_TRAITS_HPP_ #define NETWORKIT_AUXILIARY_FUNCTION_TRAITS_HPP_ #include #include namespace Aux { // Code taken from https://functionalcpp.wordpress.com/2013/08/05/function-traits/ and slightly // modified template struct FunctionTraits; // function pointer template struct FunctionTraits : public FunctionTraits {}; template struct FunctionTraits { using result_type = R; static constexpr size_t arity = sizeof...(Args); template struct arg_impl; template struct arg_impl {}; template struct arg_impl { using type = typename std::tuple_element>::type; }; template using arg = arg_impl < N, N; }; // member function pointer template struct FunctionTraits : public FunctionTraits {}; // const member function pointer template struct FunctionTraits : public FunctionTraits {}; // member object pointer template struct FunctionTraits : public FunctionTraits {}; // functor template struct FunctionTraits { private: using call_type = FunctionTraits; public: using result_type = typename call_type::result_type; static constexpr size_t arity = call_type::arity - 1; template using arg = typename call_type::template arg; }; template struct FunctionTraits : public FunctionTraits {}; template struct FunctionTraits : public FunctionTraits {}; } // namespace Aux #endif // NETWORKIT_AUXILIARY_FUNCTION_TRAITS_HPP_