In this answer from this question the author posted this code:
template <typename... Ts>
typename std::tuple_element<0, std::tuple<Ts...> >::type // or decltype(auto)
callFunction(Ts&&... ts)
{
using type = typename std::tuple_element<0, std::tuple<Ts...> >::type;
auto it = multiCache.find(typeid(type));
assert(it != multiCache.end());
auto&& fn = boost::any_cast<const std::function<type(Ts...)>&>(it->second);
return fn(std::forward<Ts>(ts)...);
}
The meaning of typename std::tuple_element<0, std::tuple<Ts...> >::type
is that the returned type is the same of the first element of the first element in Ts...
, right?