Create constraint for each parameter in template arg pack

Andrey saasecondbox at yandex.ru
Tue Aug 28 13:49:38 UTC 2018


On Tuesday, 28 August 2018 at 13:05:15 UTC, bauss wrote:
> I'm not sure if there is a better way, but isInstanceOf 
> (std.traits) seems to work with a static foreach and a static 
> if.
>
> template Qwerty(Values...)
> {
>     static foreach (value; Values)
>     {
>         static if (!isInstanceOf!(Qaz, value))
>         {
>             static assert(0, "Values are not Qaz only ...");
>         }
>     }
>
>     // ...
> }

Thank you everybody!



More information about the Digitalmars-d-learn mailing list