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)...);
}
typename std::tuple_element<0, std::tuple<Ts...> >::type
の意味は、返される型は、の最初の要素と同じであるということですTs...
の最初の要素、右?
はい、これは、貧困層の「型パラメータパックへのインデックス」です。 'T &&、Ts && ...'を使って関数を書くだけで、 'T 'を直接使うかもしれないので、この場合はやや愚かです。 –