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_cast - multiple declarations

Function BigInt.opCast

Implements casting to bool.

Prototype

T opCast(T)() const pure nothrow @nogc;

Example

// Non-zero values are regarded as true
auto x = BigInt("1");
auto y = BigInt("10");
assert(x);
assert(y);

// Zero value is regarded as false
auto z = BigInt("0");
assert(!z);


Function BigInt.opCast

Implements casting to/from qualified BigInt's.

Prototype

T opCast(T)() const pure nothrow @nogc
if (is(Unqual!T == BigInt));

Warning

Casting to/from const or immutable may break type system guarantees. Use with care.

Example

const(BigInt) x = BigInt("123");
BigInt y = cast() x;    // cast away const
assert(y == x);


Authors

Don Clugston

License

Boost License 1.0.

Comments