This doesn't work:

        foreach (i; 0 .. T.tupleof.length)
                static if (is(typeof(T.tupleof[i]) == int))  // error!
                        ...

because the foreach isn't static.


It forces me to write:

        template Iota(size_t i, size_t n)
        {
                static if (n == 0) { alias TypeTuple!() Iota; }
                else { alias TypeTuple!(i, Iota!(i + 1, n - 1)) Iota; }
        }

        foreach (i; Iota!(0, T.tupleof.length))  // "static foreach"
                static if (is(typeof(T.tupleof[i]) == int))
                        ...

which gets annoying quickly.


Why not just let us write

        static foreach (i; 0 .. T.tupleof.length)
                static if (is(typeof(T.tupleof[i]) == int))
                        ...

so that the code is a lot more succinct and easy to write?

Reply via email to