On Monday, March 07, 2011 10:38:44 André Stein wrote: > I tried both signatures of opCmp but the result seemed the same (both > sequences of structs sorted correctly). So I wonder what is the default > comparison of a user defined struct type? Not implementing an opCmp > function lead to a compiler error..
It probably either does a comparison of the object's byte representation or compares each member variable in turn. I don't know - probably something along the lines of the former. I wouldn't recommend relying on it. Regardless, in this case, you have the int first, so unless you compare two structs with the same value for that first int field, you wouldn't see any difference anyway. - Jonathan M Davis
