Table lookups - this is pretty definitive

bearophile bearophileHUGS at lycos.com
Wed Apr 2 14:58:32 PDT 2014


Brad Anderson:

>> immutable bool[256] tab3 =
>>    ubyte
>>    .max
>>    .iota!"[]"
>
> I can't decide if this part is brilliant or terrible. Clever, 
> either way.

That iota enhancement has nothing terrible: the "[]" syntax is 
already used in Phobos for std.range.uniform, and it's quite 
needed, otherwise it can't generate the right bound of a type 
(like the last ubyte, last byte, last char, last int, etc).

Bye,
bearophile


More information about the Digitalmars-d mailing list