From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2008-03-30 16:13:11
"Kevin Sopp" wrote in message
> Hi all,
> I've been busy with porting the public domain C library libtommath to
> C++. The code is quite usable as it is and some simple documentation
> exists in the libs/mp_math/doc/html subfolder. I've implemented all
> C++ operators for the mp_int<> type and it can thus be used just like
> a built-in integer type. Some things like random number generation and
> primality testing have not been documented yet.
> Please have a look, I'm looking for feedback at the moment so that I
> can plan on how to proceed.
Just for your info I designed another interface, see document N2143 on:
The root question here seems to be: do you use runtime polymorphism (virtual
functions) or compile time polymorphism (templates). My argument is that as
this class is so close to the hardware, and performance is so important,
that runtime polymorphism will in this case provide the runtime flexibility
In your design the algorithms will probably end up in headers (just like the
STL), while my algorithms will end up in DLLs. In other words: my design
considers the allocator and the traits as implementation details (although
in my design it is possible to change the allocator dynamically), while your
design considers these as design parameters.
In other words: in my opinion an integer is not a container, so compile-time
flexibility is not needed, while runtime flexibility is needed for
combination in expressions of signed/unsigned/modular types and base tpye
pointers to derived type objects.
Thus these two designs are more or less orthogonal.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk