.sizeof on templates needs extra parens?

C. Dunn cdunn2001 at gmail.com
Tue Jul 31 21:11:15 PDT 2007


Why do I need extra parentheses to get template.sizeof?

class A(T){
  T x;
};

int y = (A!(int)).sizeof;
int z = A!(char).sizeof; // does not compile (line 6)

hello.d(6): Error: undefined identifier class A.sizeof
hello.d(6): Error: cannot implicitly convert expression (class A.sizeof) of type void to int


More information about the Digitalmars-d-learn mailing list