On Monday, 29 July 2013 at 13:23:23 UTC, JS wrote:
Sometimes it's nice to be able to have groups of variadic
parameters:
template t(T1..., T2...)
...
t!(a, b, c; d, e, f);
so that a,b,c are for T1 and d,e,f are for T2.
This can be done by making a symbol and breaking up a single
variadic but is messy.
I doubt such a feature will ever get added but who knows...
I was initially unimpressed, but after some recent work I would
really like this feature. I have been using
struct Group(T...)
{
alias Ungroup = T;
}
but, useful as it is, this feels like something that should have
some sugar on it.
template A(T0 ..., T1 ...)
{
// use T0 & T1
}
A!(int, long, double; Point, int)
is so much nicer than
template A(T0, T1)
if(isGroup!T0 && isGroup!T1)
{
alias t0 = T0.Ungroup;
alias t1 = T1.Ungroup;
//use t0 && t1
}
A!(Group!(int, long, double), Group!(Point, int))