GMP and C++11 move constructors
Marco Bodrato
bodrato at mail.dm.unipi.it
Wed May 23 17:15:59 UTC 2018
>From gmp-discuss:
Il Lun, 21 Maggio 2018 12:15 pm, Marc Glisse ha scritto:
> If m is a
> moved-from object, it is fine to assign a new value to it with m =
> whatever. That's even what std::swap does. It should also be fine to
> read from it, although you can't rely on any specific value so that's
> not very useful.
Should the non specific value be somehow valid?
With lazy allocation, we should define NaN as an admissible value for mpq,
and use it whenever we init a variable that will immediately be
overwritten.
I did this, internally in mini-mpq:
https://gmplib.org/repo/gmp/rev/8e0a2e94ae5a
The idea might be useful also for some mpq constructor from double, from
string... if not for move.
Wile we are looking into this, is there a motivation why we have the
assignment "operator=(mpz_class &&z)" for mpq_class, but not a constructor
from mpz_class&& ?
Ĝis,
m
--
http://bodrato.it/
More information about the gmp-devel
mailing list