Skip to content

Instantly share code, notes, and snippets.

@elliotpotts
Created October 20, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elliotpotts/66190b178d6fa1a32246 to your computer and use it in GitHub Desktop.
Save elliotpotts/66190b178d6fa1a32246 to your computer and use it in GitHub Desktop.
template <typename T>
struct function_traits : public function_traits<decltype(&T::operator())>{
};
template <typename ClassType, typename ReturnType, typename... Args>
struct function_traits<ReturnType(ClassType::*)(Args...) const> {
static constexpr auto arity = sizeof...(Args);
typedef ReturnType result_type;
template <size_t i>
using arg = std::tuple_element_t<i, std::tuple<Args...>>;
using args = typename std::tuple<Args...>;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment