X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ffactor.cpp;h=2f9157b97a81082c0b38ab11873b820af6dcdaa3;hp=b8a1fb8ed296dc0b2a5a573e9c390d984c6b1512;hb=4cf514ec7a3d8dbb447eaa46747f31a9fc9cf159;hpb=cbba7a5eb9d33003c081a8017dec7da3aa990571 diff --git a/ginac/factor.cpp b/ginac/factor.cpp index b8a1fb8e..2f9157b9 100644 --- a/ginac/factor.cpp +++ b/ginac/factor.cpp @@ -218,8 +218,32 @@ static void expt_pos(umodpoly& a, unsigned int q) } } +template struct enable_if +{ + typedef T type; +}; + +template struct enable_if { /* empty */ }; + +template struct uvar_poly_p +{ + static const bool value = false; +}; + +template<> struct uvar_poly_p +{ + static const bool value = true; +}; + +template<> struct uvar_poly_p +{ + static const bool value = true; +}; + template -static T operator+(const T& a, const T& b) +// Don't define this for anything but univariate polynomials. +static typename enable_if::value, T>::type +operator+(const T& a, const T& b) { int sa = a.size(); int sb = b.size(); @@ -250,7 +274,11 @@ static T operator+(const T& a, const T& b) } template -static T operator-(const T& a, const T& b) +// Don't define this for anything but univariate polynomials. Otherwise +// overload resolution might fail (this actually happens when compiling +// GiNaC with g++ 3.4). +static typename enable_if::value, T>::type +operator-(const T& a, const T& b) { int sa = a.size(); int sb = b.size();