On 10/30/12 4:17 PM, Tobias Pankrath wrote:
On Tuesday, 30 October 2012 at 20:16:12 UTC, Tobias Pankrath
wrote:
In the meantime you can use this function template to compare structs
field by field.
bool oneStepEqual(T,F)(ref T lhs, ref F rhs)
if(is(Unqual!T == Unqual!F) && is(T == struct))
{
bool result = true;
foreach(mem; __traits(allMembers, T))
{
static if(!is(typeof(__traits(getMember, T, mem)) == function))
{
result = result && (__traits(getMember, lhs, mem) ==
__traits(getMember, rhs, mem));
}
}
return result;
}
Beautiful version: http://dpaste.dzfl.pl/2340d73f
Y u no short circuit?
Andrei