Reputation: 794
I've been calling get_mpz_t()
a lot on mpz_class
types. I don't really get it's point. I have red the documentation and from what I can tell, it's needed just because some functions require mpz_t
and not mpz_class
?
To copy the example given in the documentation, I find I often call it in a situation like this but with various functions:
mpz_class a, b, c;
...
mpz_gcd (a.get_mpz_t(), b.get_mpz_t(), c.get_mpz_t());
If the only difference is the syntax, can it be omitted or automated so I don't have to type it as much? I am much more familiar with C++ than C.
Upvotes: 1
Views: 213
Reputation: 87944
Why not write your own wrapper function?
inline void mpz_gcd(mpz_class& a, const mpz_class& b, const mpz_class& c)
{
mpz_gcd(a.get_mpz_t(), b.get_mpz_t(), c.get_mpz_t());
}
Given that this is C++ you can even give the wrapper function the same name as the original.
Upvotes: 3