dimanche 24 juillet 2016

Combining GMPXX and C++11 and later

I have minor problem when combining GMP and C++11.

Example program:

#include <gmpxx.h>

int main()
{
    mpz_class a,b; //ok
    auto c = a+b; //ok (?)
    c = 0; //error
}

Error message:

error: no match for 'operator=' (operand types are '__gmp_expr<__mpz_struct [1], __gmp_binary_expr<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>, __gmp_binary_plus> >' and 'int')
     c = 0;
       ^

What's the problem?

Aucun commentaire:

Enregistrer un commentaire