On 3/29/12, Andrej Mitrovic <[email protected]> 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;
}
