Suppose one has the following template function:
template<typename T> auto foobar () { return std::string("why not"); }
Question: is it possible to define a type trait that provides the template parameter of the function ?
If we call get_template_parameter such a trait, one could then write:
template<typename T> auto foobar () { return std::string("why not"); }
using type = typename get_template_parameter <decltype(foobar<double>)>::type;
static_assert (std::is_same_v<type,double>);
UPDATE: I added a dummy result to the foobar function in order to underline the fact that the template parameter is not related to the result of the function.
Yes, all you need is: