is(T t == U!n, U, int n)
Luís Marques
luis at luismarques.eu
Wed Jun 13 09:41:45 UTC 2018
If this works:
template X(T)
{
static if(is(T t == S!n, int n))
{
static if(n == 0)
alias X = AliasSeq!();
else
alias X = S!0;
}
else
{
static assert(0);
}
}
class S(int n) { }
pragma(msg, X!(S!3)); // S!0
pragma(msg, X!(S!0)); // ()
...why can't I generalize it to match U!n, for some U, int n?
template X(T)
{
static if(is(T t == U!n, U, int n))
{
static if(n == 0)
alias X = AliasSeq!();
else
alias X = U!0;
}
else
{
static assert(0);
}
}
class S(int n) { }
pragma(msg, X!(S!3)); // static assert: 0
More information about the Digitalmars-d
mailing list