GMP and C++11 move constructors
marc.glisse at inria.fr
Fri May 18 13:01:10 UTC 2018
On Fri, 18 May 2018, Hans Åberg wrote:
> FYI, if one follows the GMP API, it forces C++11 move constructors to make a heap allocation via mpz_init, which then is immediately destroyed using mpz_clear. The reason is that the API does not guarantee that nothing happens if the pointer is set to NULL even if one uses a deallocator, like 'free', with that property.
If you look at the current repository, you'll notice that mpz_init does
not perform a heap allocation anymore.
More information about the gmp-discuss