On Tuesday, 8 September 2020 at 14:18:14 UTC, Cecil Ward wrote:
I assumed I would have to create a struct type definition and
handle various operators. How many will I have to handle? I
would of course make it a template so I can reuse this
otherwise horribly repetitive code.
You can see a full list of overloadable operators here:
https://dlang.org/spec/operatoroverloading.html
Most likely you will want to handle all of the binary operators,
unary operators, and assignment operators.
For runtime checking, you will probably want to use an invariant,
rather than writing individual checks in each member function:
https://dlang.org/spec/contracts.html#Invariants