Any way to use static foreach on multiple types?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Oct 2 21:11:17 PDT 2011


import std.typetuple;
alias TypeTuple!(int, double) Types;

void main()
{
    foreach (T1, T2; Types, Reverse!Types)
    {
    }
}

That right there is buggy code on my part, T1 ends up being an index
variable and this is another one of those cases where the comma
doesn't do anything but confuse people (or just me :p).

Anyway, I need some sort of static lockstep, is there such a thing in Phobos?

It's not mission-critical, but I want to write a nice stress-test of
conversions between my own custom types, and it would be cool if I
could do it in a foreach loop with terse syntax.


More information about the Digitalmars-d-learn mailing list