c++ - How to use std::cout with mini-gmp mpz-t? -
just title suggests, i'm having issues when trying print mpz_t
values using std::cout
mini-gmp. can use mpz_get_si
convert integer, , seems working, defeats purpose of gmp altogether.
when use std::cout
seems print memory address of mpz_t
variable. have solution printing mpz_t
values using mini-gmp?
by documentation seems class overrides cout is, should supported https://gmplib.org/manual/c_002b_002b-formatted-output.html
note: feature loss due mini-gmp vs gmp
although caution:
"but note ostream output (and istream input, see c++ formatted input) overloading available gmp types , instance using + mpz_t have unpredictable results. classes overloading, see c++ class interface."
aside if getting memory address think there should value, make sure aren't dealing mpz_t* , dereference , see if type error. it's hard tell without seeing code
Comments
Post a Comment