3/29/12, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote: > snip
Crap, lockstep doesn't work on different types, it was iterating over the arrays. That went over my head. A slightly complicated version that actually works: import std.stdio; import std.conv; string tupleCompare(int len)() { string result; foreach (i; 0 .. len) { result ~= " if (this.tupleof[" ~ to!string(i) ~ "] != t.tupleof[" ~ to!string(i) ~ "]) return false; "; } return result; } template safeOpEquals() { bool opEquals(typeof(this) t) { enum len = typeof(this).tupleof.length; mixin(tupleCompare!len); return true; } }