Reputation: 31
I have converted a mpz_int
to gmp_int
by converting a mpz_int
to mpz_class
and then converting the mpz_class
instance to a gmp_int
.
Is there an easier way to do it ?
thanks
Upvotes: 1
Views: 1149
Reputation: 7915
From the tutorial and documentation, there is a member function backend()
in mpz_int
that gives access to the underlying gmp_int
.
Upvotes: 2
Reputation: 392833
For me, the convert_to<>
method seems to work: Live On Coliru
#include <boost/multiprecision/mpfr.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
int main()
{
cpp_int i;
mpz_int z;
i = z.convert_to<cpp_int>();
}
Upvotes: 0