Re: Create constraint for each parameter in template arg pack

2018-08-28 Thread Andrey via Digitalmars-d-learn
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)

Re: Create constraint for each parameter in template arg pack

2018-08-28 Thread vit via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote: Hello, Let we have two variadic templates: template Qwerty(Values...) {} template Qaz(alias type, Data...) {} Now I want to add a constraint to "Qwerty" so that each type in "Values" pack must be a "Qaz" template. I don't care about v

Re: Create constraint for each parameter in template arg pack

2018-08-28 Thread Alex via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 13:05:15 UTC, bauss wrote: On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote: Hello, Let we have two variadic templates: template Qwerty(Values...) {} template Qaz(alias type, Data...) {} Now I want to add a constraint to "Qwerty" so that each type in "Va

Re: Create constraint for each parameter in template arg pack

2018-08-28 Thread bauss via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote: Hello, Let we have two variadic templates: template Qwerty(Values...) {} template Qaz(alias type, Data...) {} Now I want to add a constraint to "Qwerty" so that each type in "Values" pack must be a "Qaz" template. I don't care about v

Re: Create constraint for each parameter in template arg pack

2018-08-28 Thread vit via Digitalmars-d-learn
On Tuesday, 28 August 2018 at 12:28:19 UTC, Andrey wrote: Hello, Let we have two variadic templates: template Qwerty(Values...) {} template Qaz(alias type, Data...) {} Now I want to add a constraint to "Qwerty" so that each type in "Values" pack must be a "Qaz" template. I don't care about v

Create constraint for each parameter in template arg pack

2018-08-28 Thread Andrey via Digitalmars-d-learn
Hello, Let we have two variadic templates: template Qwerty(Values...) {} template Qaz(alias type, Data...) {} Now I want to add a constraint to "Qwerty" so that each type in "Values" pack must be a "Qaz" template. I don't care about values of "type" or "Data" in "Qaz". How to do it in D?