Table lookups - this is pretty definitive

bearophile bearophileHUGS at lycos.com
Tue Apr 1 15:32:27 PDT 2014


Andrej Mitrovic:

> Also (untested):
>
> immutable bool[256] tab2 =
>     iota(0, 0x100)
>     .map!(i => isIdentifierChar0(cast(ubyte)i))
>     .array;

Eventually this should work, and avoid the nasty cast:

immutable bool[256] tab3 =
     ubyte
     .max
     .iota!"[]"
     .map!isIdentifierChar0
     .array;


Bye,
bearophile


More information about the Digitalmars-d mailing list