Places a TypeTuple can be used

Ali Çehreli acehreli at yahoo.com
Thu Aug 15 23:09:55 PDT 2013


On 08/15/2013 10:39 PM, Meta wrote:

 > On Friday, 16 August 2013 at 04:14:04 UTC, Ali Çehreli wrote:

 >> 1) Function parameter list
 >>
 >> 2) Template parameter list
 >>
 >> 3) Array literal element list
 >>
 >> Are there more?

 > I'm not sure if it should be considered a separate case, but there is 
this:
 >
 > foreach(type; TypeTuple!(ubyte, uint, ulong))
 > {
 >      writeln(type.max);
 > }

Thanks! That's a very interesting one. Other than the peculiarity of the 
loop being a compile-time foreach, that TypeTuple is appearing at a 
place where its expansion is not even valid:

     foreach (type; ubyte, uint, ulong) {    // compilation error

Ali



More information about the Digitalmars-d-learn mailing list