xersi xersi - 22 days ago 5x
C++ Question

Assign a BigInteger to a normal integer

For example, I can do this :

uint64_t a = 100;
BigInteger b = a;

But I can't do this :

BigInteger a = 100;
uint64_t b = a;

Is there any way? Thanks.


The simplest solution is to make BigInteger implicitly convertible to uint64_t. This can be achieved with a conversion operator:

BigInteger::operator uint64_t();