1 import checkedint.sticky : smartOp; // smartOp.cmp() never throws
2
3 assert(uint.max == -1);
4 assert( smartOp.cmp!"!="(uint.max, -1));
5 assert(-3156 > 300u);
6 assert( smartOp.cmp!"<"(-3156, 300u));
7
8 assert(!smartOp.cmp!"<"(1, real.nan));
9 assert(!smartOp.cmp!"<"(real.nan, 1));
Compare left and right using op.
Direct comparisons between boolean values and numeric ones are forbidden. Make the intent explicit: