On 3/29/12, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:
> D makes things so damn easy.

Correction, makes things easier. No need to pass the type of 'this':

template safeOpEquals()
{
    bool opEquals(typeof(this) t)
    {
        foreach (lhsField, rhsField; lockstep(this.tupleof, t.tupleof)) {
            if (lhsField != rhsField)
                return false;
        }
        return true;
    }
}
struct Foo
{
    int[] arr;
    mixin safeOpEquals;
}

Reply via email to