GMP and C++11 move constructors

Hans Åberg haberg-1 at
Fri May 18 12:54:20 UTC 2018

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.

More information about the gmp-discuss mailing list