D是否支持模板模板参数?我将如何使以下工作?
struct Type(alias a, alias b) { alias a A; alias b B; }
template MakeType(alias a, alias b)
{
alias Type!(a, b) MakeType;
}
template Foo(alias a, U) // where U is a Type
{
//...
}
template Foo(alias a, U : MakeType!(a, b), b...) // where U is a specialization
{
//...
}
并且Foo
应该这样称呼:
alias MakeType!(5, 7) MyType;
alias Foo!(5, MyType) Fooed; // error
Error: template instance Foo!(5,Type!(5,7)) Foo!(5,Type!(5,7)) does not match template declaration Foo(alias a,U : MakeType!(a,b),b...)