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 –