View source code Display the source code in std/bigint.d from which this page was generated on github. Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.bigint.big_int.op_op_assign - multiple declarations

Function BigInt.opOpAssign

Implements assignment operators from built-in integers of the form BigInt op= integer.

Prototype

BigInt opOpAssign(string op, T)(
  T y
) pure nothrow
if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == ">>" || op == "<<" || op == "^^" || op == "|" || op == "&" || op == "^") && isIntegral!T);

Example

auto b = BigInt("1_000_000_000");

b += 12345;
assert(b == BigInt("1_000_012_345"));

b /= 5;
assert(b == BigInt("200_002_469"));


Function BigInt.opOpAssign

Implements assignment operators of the form BigInt op= BigInt.

Prototype

BigInt opOpAssign(string op, T)(
  T y
) pure nothrow
if ((op == "+" || op == "-" || op == "*" || op == "|" || op == "&" || op == "^" || op == "/" || op == "%") && is(T : BigInt));

Example

auto x = BigInt("123");
auto y = BigInt("321");
x += y;
assert(x == BigInt("444"));


Authors

Don Clugston

License

Boost License 1.0.

Comments