Qualify recursive calls to avoid ambiguity for types that have their own gcd/lcm

This commit is contained in:
John Maddock
2017-05-04 11:12:33 +01:00
parent c1a08d3185
commit 84ded579f3

View File

@ -445,9 +445,9 @@ template <typename Integer>
inline BOOST_CXX14_CONSTEXPR Integer gcd(Integer const &a, Integer const &b) BOOST_GCD_NOEXCEPT(Integer)
{
if(a == (std::numeric_limits<Integer>::min)())
return a == static_cast<Integer>(0) ? gcd_detail::gcd_traits<Integer>::abs(b) : gcd(static_cast<Integer>(a % b), b);
return a == static_cast<Integer>(0) ? gcd_detail::gcd_traits<Integer>::abs(b) : boost::integer::gcd(static_cast<Integer>(a % b), b);
else if (b == (std::numeric_limits<Integer>::min)())
return b == static_cast<Integer>(0) ? gcd_detail::gcd_traits<Integer>::abs(a) : gcd(a, static_cast<Integer>(b % a));
return b == static_cast<Integer>(0) ? gcd_detail::gcd_traits<Integer>::abs(a) : boost::integer::gcd(a, static_cast<Integer>(b % a));
return gcd_detail::optimal_gcd_select(static_cast<Integer>(gcd_detail::gcd_traits<Integer>::abs(a)), static_cast<Integer>(gcd_detail::gcd_traits<Integer>::abs(b)));
}