I am reading some c++ code, and the code list below makes me really confused.
I can guess it tries to define a specialized template, which tries to trait the input args types. But I got a few question:
the first template looks like both deriving and template specialization, if it is deriving, how can a struct derived from itself? if it is a template specialization, where is the template defination?
template<typename F>
struct function_traits : public function_traits<decltype(&F::operator())>
{};
template<typename R, typename C, typename ... Args>
struct function_traits<R(C::*)(Args...) const> {
template<size_t i>
struct arg
{
using type = typename std::tuple_element<i, std::tuple<Args...>>::type;
};
};