Are templates with variadic value parameters possible?

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 14 22:23:15 PDT 2016


On Friday, 15 July 2016 at 04:38:03 UTC, Basile B. wrote:
> two obvious:
>
> - recursive template.
> - staticIota in a foreach. (aliasSeqOf!(iota(1, T.length))

even better:

template sameType(T...)
{
     import std.meta;
     static if (!T.length)
         enum sameType = false;
     else
         enum sameType = NoDuplicates!T.length == 1;
}


More information about the Digitalmars-d-learn mailing list