1
GMPとC++ 11を組み合わせたときのマイナーな問題があります。GMPXXとC++ 11以降を組み合わせる
プログラム例:
#include <gmpxx.h>
int main()
{
mpz_class a,b; //ok
auto c = a+b; //ok (?)
c = 0; //error
}
エラーメッセージ:
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;
^
問題は何ですか?
この場合、 'auto'は式テンプレートでうまく再生されません。 – ildjarn
https://lanbsutter.com/2012/04/03/reader-qa/ https://lanzkron.wordpress.com/2011/02/21/inferring-too-much/ –
にリンクしています。 GMPのドキュメンテーションの "C++ 11"という段落です:https://gmplib.org/manual/C_002b_002b-Interface-Limitations.html –