mpz_t C++ wrapper
modelnine at modelnine.org
Fri May 2 09:48:19 CEST 2008
Am Freitag, 2. Mai 2008 08:09:55 schrieben Sie:
> Heiko Wundram wrote:
> > It's currently just the actual biginteger.hh include file (which
> > implements the mpz_class replacement as class BigInteger; but that should
> > be pretty much transparently typedef-able to mpz_class, except for
> > get_mpz_t(), which is no longer required and/or supported, [...]
> There must be some misunderstanding. First, I don't see how a user
> would get access to all the GMP functions without get_mpz_t() (e.g.,
> suppose one needs to use mpz_popcount()).
The class BigInteger defines an operator mpz_ptr() and operator mpz_srcptr()
const, so that the explicit access to the mpz_t is no longer required. A
BigInteger object can directly be passed as a parameter to any function
expecting an mpz_[src]ptr (all the mpz_* functions) because of an implicit
conversion happening due to the two operators.
> Secondly, even if you provide
> other mechanisms to interface _all_ mpz functions, I think you should still
> support get_mpz_t() for backward compatibility.
Okay, that's fair enough.
> Finally, take into account
> that the current C++ wrapper supports, in addition to mpz, mpq and mpf.
> All the best,
I know that the current wrapper supports more of GMP than what biginteger.hh
supports, and that's why I don't currently (and actually never did) see it as
a replacement, just as an "optimized" implementation of mpz_class (just like
the mail subject should have, sort of, explained). I myself only require a
wrapper for mpz_t (because I'm using the wrapper only in Z/N), and that's
what the current wrapper implements.
More information about the gmp-discuss