The following works, but I feel like it must be possible without resorting to using decltype on the function return type:
typedef std::size_t SizeT;
template<SizeT... Indices> struct IndexList { };
template<SizeT... Is>
constexpr decltype(auto) ExtractIndices(std::integer_sequence<SizeT, Is...>)
{
return IndexList<Is...>{ };
}
template<SizeT N>
using MakeIndexSequence = std::make_integer_sequence<SizeT, N>;
template<SizeT N>
using MakeIndexList = decltype(ExtractIndices(MakeIndexSequence<N>{ }));
Is there a better way to change the "wrapper type" of a parameter pack?
Since you're just aliasing std::index_sequence
, you could just do that more explicitly:
template<SizeT... Indices>
using IndexList = std::index_sequence<Indices...>;
template<SizeT N>
using MakeIndexList = std::make_index_sequence<N>;
Though prefer to just use what's in the standard library. Introducing your own names is confusing.