Variadic grouping
Robert Clipsham
robert at octarineparrot.com
Mon Jul 29 08:02:12 PDT 2013
On Monday, 29 July 2013 at 14:46:02 UTC, Robert Clipsham wrote:
> You can achieve this like so:
> ----
> template Outer(T...) {
> template Inner(U...) {
> // Do something with T and U
> }
> }
> Outer!(a, b, c).Inner!(d, e, f);
> ----
>
> You can see an example of it in action here (type tuple
> intersection):
> https://github.com/mrmonday/misc/blob/master/misc/misc.d#L5
>
> Robert
What would be more interesting would be to have the ability to
have variadic variadics, so you could use something like:
----
template Outer(T...) {
template Inner(U... ...) {
// Do something with T, U[0], U[1], U[2..$]
}
}
Outer!(a, b, c).Inner!(d, e, f).Inner!(g, h, i); // Etc
----
Of course that raises the question of variadic variadic variadics
and variadic variadic variadic variadics and so on, and my
proposed syntax is already silly............
More information about the Digitalmars-d
mailing list