var._applyOp
private
T _applyOp(string op, T)(T a, T b) @safe pure nothrow @nogcApply a binary arithmetic operation.
For division and modulo with integer types, callers MUST check that b != 0 before calling this function and handle the zero-divisor case appropriately (e.g., by returning var.init). The defensive check inside this function returns T.init (which is 0 for integers) as a last resort, but this value is indistinguishable from a valid result and should never be relied upon.
For floating-point types, division/modulo by zero follows IEEE 754 semantics (producing infinity or NaN) and requires no pre-check.
Parameters
op | The operation: `"+"`, `"-"`, `"*"`, `"/"`, or `"%"`. |
a | Left operand. |
b | Right operand. |
Returns
The result of applying the operation.