BigInt.opBinaryRight

BigInt opBinaryRight(string op, T)(T y) if ((op == "+" || op == "*" || op == "|" || op == "&" || op == "^") && isIntegral!T) const pure @safe

Implements right-hand commutative operators (+, *, |, &, ^).

Allows expressions like int + BigInt, int * BigInt, etc. These operators are commutative, so we delegate to opBinary.

Parameters

opThe operator string
yThe left-hand operand (integral type)

Returns

Result of the operation as a BigInt
BigInt opBinaryRight(string op, T)(T y) if (op == "-" && isIntegral!T) const pure @safe

Implements right-hand subtraction operator.

Allows expressions like int - BigInt. Computes y - this.

Parameters

opThe operator string ("-")
yThe left-hand operand (integral type)

Returns

Result of y - this as a BigInt
T opBinaryRight(string op, T)(T y) if ((op == "/" || op == "%") && isIntegral!T) const pure @safe

Implements right-hand division and modulus operators.

Allows expressions like int / BigInt, int % BigInt. Returns the result as the built-in type when the result fits.

Parameters

opThe operator string ("/" or "%")
yThe left-hand operand (integral type)

Returns

Result of y / this or y % this as type T