Hans Aberg haberg-1 at telia.com
Mon Sep 26 22:42:00 CEST 2011

On 26 Sep 2011, at 22:14, Marc Glisse wrote:

>>> If you have comments on the approach, or on other C++11 features that would help... (note that there are still many improvements possible without using new C++ features, which have a higher priority)
>> It might be possible to implement ordinary classes (integer, rational, ...) without runtime overhead. This would be easier to use.
> I am sorry, I don't understand what you mean.
> Just on the off chance that you are suggesting dropping expression templates and relying on copy elision and/or rvalue references to reduce the number of temporaries:

Yes, but there would still be a template for the memory allocation.

> I thought about it, but for things like a=b+c (a is a pre-existing variable), you won't be able to avoid creating a temporary, and for small numbers that's bad.

C++11 has support for movable copy constructors, which would be used instead. One still needs to do a memory allocation, but must always be done.

> That doesn't mean such a C++ wrapper to gmp would be a bad idea.

I wrote one a long time ago (without template argument for memory allocation), but because of the problem you mentioned, it did not seem any point making it a part of a GMP distribution.


More information about the gmp-discuss mailing list