Specifying precision in vector<mpf_class>?

Ballabio Gerardo - Dip. di Scienza dei Materiali gerardo.ballabio@unimib.it
Tue, 26 Aug 2003 12:01:34 +0200


I've started to look at the details and found that the 
mpf_class<prec> thing can't be done straightforwardly.

The problem is that in the current implementation, mpf_class is a 
specialization of a generic "gmp_expr" template class, renamed with a 
typedef like this:

   typedef gmp_expr<mpf_t> mpf_class;

An mpf_class with the precision as a template argument would be 
declared like this:

   template <int N> typedef gmp_expr<mpf_t, N> mpf_class<N>;

but such a "template typedef" is not a valid C++ construct. In fact 
there's no way to implement it, so far as I know.

Thus, mpf_class must be defined independently on gmp_expr, but then 
we'd have two distinct types and this would require the duplication 
of a lot of stuff. I believe it can still be done, but I doubt that 
it's worth the effort.

Gerardo