On Fri, 18 Feb 2005 22:28:52 +1100, Richard Cavell
<ri***********@mail.com> wrote:
#include <gmp.h>
vector<mpz_t> v_bigints; v_bigints.resize(20);
This fails.
error: ISO C++ forbids casting to an array type '__mpz_struct[1]' (GCC
on a G4)
What's wrong with this? (GMP mailing lists were closed today, sorry).
See my reply in thread "Cannot 'new' a GMP object", Message-ID
<sl******************@ccserver.keris.net>
mpz_t is defined as a 1-element array, to make using the C GMP functions
easier, which blows the C syntax for containers and new. Plus it is
risky, since you will have to ensure that each of the elements is
correctly initialised and cleared whenever you resize the vector
otherwise you will get momory leaks. The C++ class versions are much
easier to us.
Chris C