Oh, nice, here's an ICE for y'all :)

struct Matrix(T)
{
    @property T[] data() { return null; }

    int opApply(scope int delegate(ref size_t[], ref T) dg) { return 0; }
int opApply(scope int delegate(ref const(size_t[]), ref const(T)) dg) const { return 0; }

Matrix!(typeof(mixin("data[0] " ~ op ~ " data[0]"))) opBinary(string op)(Matrix other)
    {
        auto result = typeof(return)();
        foreach (i, ref val; this)
        { mixin("result[i] = val " ~ op ~ " other[i];"); }
        return result;
    }
}

void main() { auto m = Matrix!size_t(); m = m * m; }

Reply via email to