Table lookups - this is pretty definitive

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Apr 1 13:57:40 PDT 2014


On 4/1/14, Artur Skawina <art.08.09 at gmail.com> wrote:
> You mention AAs, so you may already realize this, but there is no
> need for a mod ctor in the above example:
>
>    immutable bool[256] tab2 = {
>       bool t[256];
>       for (size_t u = 0; u < 0x100; ++u)
>           t[u] = isIdentifierChar0(cast(ubyte)u);
>       return t;
>    }();

Also (untested):

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


More information about the Digitalmars-d mailing list