[Article Submission] Have Your Efficiency, and Flexibility Too

Timon Gehr timon.gehr at gmx.ch
Tue May 31 05:20:25 PDT 2011


Ary Manzana wrote:
> Why you need a type tuple? Can't you do:
>
> foreach(np; [1, 2, 3, 5, 10])

That is a runtime foreach, so no. If the argument is a TypeTuple, the compiler
evaluates the foreach as a "static foreach", effectively duplicating all code in
its body and filling in the constants/types in the tuple.
I would like an explicit "static foreach" better though.

Timon


More information about the Digitalmars-d mailing list