Checked instance representing the result of the binary
operation
auto opBinary(string op, Rhs)(const Rhs rhs) if (isIntegral!Rhs || isFloatingPoint!Rhs || is(Rhs == bool))Defines binary operators `+`, `-`, `*`, `/`, `%`, `^^`, `&`, `|`, `^`, `<<`, `>>`, and `>>>`. If Hook defines hookOpBinary, opBinary forwards to Checked!(typeof(hook.hookOpBinary!op(get, rhs)), Hook)(hook.hookOpBinary!op(get, rhs)).
If Hook does not define hookOpBinary but defines onOverflow, opBinary forwards to hook.onOverflow!op(get, rhs) in case an overflow occurs.
If two Checked instances are involved in a binary operation and both define hookOpBinary, the left-hand side hook has priority. If both define onOverflow, a compile-time error occurs.
op | The binary operator |
rhs | The right hand side operand |
U | If rhs is a Checked instance, U represents the underlying instance type |
Hook1 | If rhs is a Checked instance, Hook1 represents the instance's behavior hook |
Checked instance representing the result of the binary
operation
auto opBinary(string op, Rhs)(const Rhs rhs) if (isIntegral!Rhs || isFloatingPoint!Rhs || is(Rhs == bool)) constditto