I've seen many answers online such as this one, but they do not seem to work when the parameter pack is of std::size_t.
template <typename ...Ts> struct select_last { using type = typename decltype((std::type_identity<Ts>{}, ...))::type; }; template<std::size_t... N> class Example { private: using type = select_last<int, double>::type; // works using size_t_type = select_last<size_t... N>::type; // doesn't work }; How can I get the last element of a parameter pack of type std::size_t?
Tscannot be default constructed. You should usestd::declval<Ts>()instead.