Defines a total order on all basic scalar values, using the same rules as std.math.cmp().
Direct comparisons between boolean values and numeric ones are forbidden. Make the intent explicit:
1 import checkedint.sticky : smartOp; // smartOp.cmp() never throws 2 3 assert(smartOp.cmp(325.0, 325u) == 0); 4 assert(smartOp.cmp(uint.max, -1) == 1); 5 assert(smartOp.cmp(-3156, 300u) == -1);
See Implementation
Defines a total order on all basic scalar values, using the same rules as std.math.cmp().
Direct comparisons between boolean values and numeric ones are forbidden. Make the intent explicit: