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.)

Reply via email to