i am using an open source code, while piece of the code can not be successfully compiled
template <typename T>
struct Function_Traits
: public Function_Traits<decltype(&T::operator())>
{};
// For generic types, directly use the result of the signature of its 'operator()'
template <typename ClassType, typename ReturnType, typename... Args>
struct Function_Traits<ReturnType(ClassType::*)(Args...) const>
// we specialize for pointers to member function
{
enum { arity = sizeof...(Args) };
// arity is the number of arguments.
typedef ReturnType result_type;
template <size_t i>
struct arg
{
typedef typename std::tuple_element<i, std::tuple<Args...>>::type type;
// the i-th argument is equivalent to the i-th tuple element of a tuple
// composed of those arguments.
};
typedef std::function<ReturnType(Args...)> FunType;
typedef std::tuple<Args...> ArgTupleType;
};
template<typename F>
void Visit(F&& f)
{
using T = typename Function_Traits<F>::arg<0>::type;
}
the compiler is gcc 5.4.0, and it complains:
error: expected ‘;’ before ‘<’ token
using T = typename Function_Traits<F>::arg<0>::type;
why is this an error, and how to fix this error?