staticIndexOf is incredibly slow and memory intensive

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Aug 26 16:00:38 PDT 2012


On 8/27/12, Philippe Sigaud <philippe.sigaud at gmail.com> wrote:
> Is the is(typeof(T == I)) really necessary? If T == I is an error,
> then is() returns false, or am I mistaken?
>

In my OP example I've had to use a typeof() test because otherwise I
could get an out of bounds compile-time error. The is() expression
doesn't seem to gag these errors, e.g.:

void main()
{
    alias TypeTuple!(int) x;
    static if (is(int == x[4]))
    {
    }
}

test.d(17): Error: tuple index 4 exceeds 1

I just noticed something though, if the order is swapped there's no error:
void main()
{
    alias TypeTuple!(int) x;
    static if (is(x[4] == int))
    {
    }
}

Bug maybe?


More information about the Digitalmars-d mailing list