comma inside is expression

Jos van Uden user at domain.invalid
Wed Mar 14 19:34:44 PDT 2012


I've been reading the tutorial on templates and found this example:

template rank(T)  {
     static if (is(T t == U[], U)) // is T an array of U, for some type U?
         enum rank = 1 + rank!(U); // then let’s recurse down.
     else
         enum rank = 0; // Base case, ending the recursion.
}


TDPL never mentions the use of a comma operator inside an is
expression. Is this an undocumented feature? Also the symbol
't' is never used, but if I remove it, it won't compile.

It's a really good tutorial, but I find this particular example
puzzling.

Jos


More information about the Digitalmars-d-learn mailing list