On Monday, 14 September 2015 at 07:05:23 UTC, Meta wrote:
You could turn it into a Tuple and use the `expand` method to
get a TypeTuple (AliasSeq).
import std.typecons;
import std.typetuple;
import std.stdio;
template genTypeList(T, size_t n)
{
static if (n <= 1)
{
alias genTypeList = T;
}
else
{
alias genTypeList = TypeTuple!(T, genTypeList!(T, n - 1));
}
}
auto asTuple(T, size_t n)(ref T[n] arr)
{
return Tuple!(genTypeList!(T, n))(arr);
}
BTW: What about .tupleof? Isn't that what should be used here?