foreach runs at runtime, while mixin is expanded at compile time.

Not the whole truth though.

foreach over tuples gets unrolled at compile time so you can do stuff like:

// +=, -=, ...
Vector opOpAssign(string op, U)(U s)
{
        foreach (i, _; tuple)
                mixin("tuple[i] " ~ op ~ "= s;");
        return this;
}

Reply via email to