Function std.experimental.checkedint.ProperCompare.hookOpEquals
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 equality, for example uint or -1_294_967_296 ==
3_000_000_000u. The call hookOpEquals(x, y) returns true if and only
if x and y represent the same arithmetic number.
bool hookOpEquals(L, R)
(
L lhs,
R rhs
);
If one of the numbers is an integral and the other is a floating-point
number, hookOpEquals(x, y) returns true if and only if the integral
can be converted exactly (without approximation) to the floating-point
number. This is in order to preserve transitivity of equality: if hookOpEquals(x, y) and hookOpEquals(y, z) then hookOpEquals(y,
z), in case x, y, and z are a mix of integral and floating-point
numbers.
Parameters
| Name | Description |
|---|---|
| lhs | The left-hand side of the comparison for equality |
| rhs | The right-hand side of the comparison for equality |
Returns
The result of the comparison, true if the values are equal