On Sunday, 21 October 2012 at 20:34:51 UTC, ref2401 wrote:
what should i do to make my binary operation commutative?
You can overload opBinaryRight: MyClass opBinaryRight(string op: "+")(MyClass rhs) { if (rhs is null) { return null; } MyClass result = new MyClass(value + rhs.value); return result; } http://dlang.org/operatoroverloading.html