Specifying precision in vector<mpf_class>?

Kevin Ryde user42@zip.com.au
Wed, 16 Jul 2003 09:46:41 +1000


"Felix E. Klee" <felix.klee.gmp@gmx.net> writes:
>
> what's the easiest way to create a std::vector of mpf_class with a certain
> precision PREC (which is not the default precision)? I tried subclassing 
> mpf_class but as explained in the online help this leads to much trouble 
> because one has to redefine many operators.

It'd be nice if we could make that easier.

> If there's no easy way: Has someone considered adding the precision as a
> template parameter? That way one could write "std::vector<mpf_class<PREC> > 
> some_vector".

I'm not up with how vector works, but can you specify a constructor
call for the elements?  That'd allow you to put a precision there.

(Cc'ed to Gerardo for his input.)