Question about @nogc

Timon Gehr via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 20 14:49:47 PDT 2014


On 05/20/2014 11:48 PM, Timon Gehr wrote:
>
> This achieves the same:
>
> template lookupTable(alias fn,uint max=255){
>      static assert(max<uint.max);
>      enum ReturnType!fn[max+1] lookupTable=iota(0,max+1).map!fn.array;
> }

(Though I'd never actually do template argument checking in a static 
assert within the template body.)


More information about the Digitalmars-d-learn mailing list