Arrays of mpz_t
Richard Cavell
richardcavell at mail.com
Sat Feb 19 01:11:06 CET 2005
Hi,
I've been trying to create an array of mpz_t. (See comp.lang.c++ for my threads). The best solution I have is something like this:
#define MAXMPZ 1000
mpz_t mympz[MAXMPZ];
if (NumberOfMPZNeeded>MAXMPZ) {printf("Increase MAXMPZ"); abort();}
for (int i=0; i<NumberOfMPZNeeded; i++)
{
mpz_init(mympz[i]);
mpz_whatever(mympz[i]);
}
This is a bit wasteful of up to MAXMPZ * sizeof (mpz_t) bytes on my heap, plus it's amateurish programming. Is there a better way? The new operator fails, as does
vector<>.
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
More information about the gmp-discuss
mailing list