ProperCompare.hookOpCmp

static auto hookOpCmp(L, R)(L lhs, R rhs)

Hook for `<`, `<=`, `>`, and `>=` that ensures comparison against integral values has the behavior expected by the usual arithmetic rules. The built-in semantics yield surprising behavior when comparing signed values against unsigned values, for example 0u < -1. The call hookOpCmp(x, y) returns -1 if and only if x is smaller than y in abstract arithmetic sense.

If one of the numbers is an integral and the other is a floating-point number, hookOpEquals(x, y) returns a floating-point number that is -1 if x < y, 0 if x == y, 1 if x > y, and NaN if the floating-point number is NaN.

Parameters

lhsThe left-hand side of the comparison for ordering
rhsThe right-hand side of the comparison for ordering

Returns

The result of the comparison (negative if lhs < rhs, positive if lhs > rhs, 0 if the values are equal)