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
values of "type" or "Data" in "Qaz".
How to do it in D?
import std.meta : allSatisfy;
template Qwerty(Values...)
if(allSatisfy!(isQaz, Values)){
}
template Qaz(alias type, Data...) {}
enum isQaz(alias Q : Qaz!Args, Args...) = true;
enum isQaz(Args...) = false;
alias Foo = Qwerty!(Qaz!(i => i), Qaz!(i => i), Qaz!(i => i));