View source code
Display the source code in std/bigint.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
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.

std.bigint.BigInt.opOpAssign - multiple declarations

Function BigInt.opOpAssign

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

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

Example

auto b = BigInt("1_000_000_000");

b += 12345;
writeln(b); // BigInt("1_000_012_345")

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

Function BigInt.opOpAssign

Implements assignment operators of the form BigInt op= BigInt.

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

Example

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

Authors

Don Clugston

License

Boost License 1.0.