The answer to this question highlights the type of function using the class template:
template <typename T> struct function_args {}; template <typename R, typename... Args> struct function_args<R(Args...)> { using type = tuple<Args...>; }; template <typename T> using decltypeargs = typename function_args<T>::type;
When I learned what is being done here, I tried to rewrite function_args . I tried to do this using a function to eliminate the need for a decltypeargs template. But it turned out that I was mired in the wrong syntax:
template <typename T> tuple<> myTry(); template <typename Ret, typename... Args> tuple<Args...> myTry<Ret(Args...)>();
Strike>
My hope was to call decltype(myTry<decltype(foo)>()) to get the tuple type instead of calling decltypeargs<decltype(foo)> . Is there any way to do this with function declaration?
c ++ templates metaprogramming template-function
Jonathan mee
source share