in C++ can I define a constant pointer for GMP?

101 Views Asked by At

This seems like it should be simple but it doesn't seem to be. I know I can define a constant by using

#define magicNumber 20

But in my class I need to multiply and divide by 2 large numbers over and over and was trying to figure out the best way. I can't just use

#define magicNumber1 10000000000
#define magicNumber2 100000000000000000000

I need something like

mpz_t magicNumber1;
mpz_init_set_str(magicNumber1,"10000000000",10);
mpz_t magicNumber2;
mpz_init_set_str(magicNumber2,"100000000000000000000",10);

and these 2 values can be used by my class over and over without reinitializing them. consteval or constexpr seem like they should be able to set up these static values but I can't seem to figure out how to do it.

0

There are 0 best solutions below