BigInt.opBinaryRight

Implements operators with built-in integers on the left-hand side and BigInt on the right-hand side.

  1. BigInt opBinaryRight(T y)
  2. BigInt opBinaryRight(T y)
    struct BigInt
    pure nothrow @safe const
    opBinaryRight
    (
    string op
    T
    )
    (
    T y
    )
    if (
    op == "-" &&
    )
  3. T opBinaryRight(T x)

Examples

auto x = BigInt("100");
BigInt y = 123 + x;
assert(y == BigInt("223"));

BigInt z = 123 - x;
assert(z == BigInt("23"));

// Dividing a built-in integer type by BigInt always results in
// something that fits in a built-in type, so the built-in type is
// returned, not BigInt.
assert(is(typeof(1000 / x) == int));
assert(1000 / x == 10);

Meta