Fix approximate_sqrt return types

This commit is contained in:
Mael Rouxel-Labbé 2021-04-06 19:43:42 +02:00
parent 00751c0869
commit fa6818b7dd
2 changed files with 6 additions and 5 deletions

View File

@ -302,19 +302,21 @@ to_interval( const Real_embeddable& x) {
} }
template <typename NT> template <typename NT>
NT approximate_sqrt(const NT& nt, CGAL::Null_functor) typename Coercion_traits<double, NT>::Type
approximate_sqrt(const NT& x, CGAL::Null_functor)
{ {
return NT(sqrt(CGAL::to_double(nt))); return sqrt(CGAL::to_double(x));
} }
template <typename NT, typename Sqrt> template <typename NT, typename Sqrt>
NT approximate_sqrt(const NT& nt, Sqrt sqrt) typename Sqrt::result_type
approximate_sqrt(const NT& nt, Sqrt sqrt)
{ {
return sqrt(nt); return sqrt(nt);
} }
template <typename NT> template <typename NT>
NT approximate_sqrt(const NT& nt) decltype(auto) approximate_sqrt(const NT& nt)
{ {
// the initial version of this function was using Algebraic_category // the initial version of this function was using Algebraic_category
// for the dispatch but some ring type (like Gmpz) provides a Sqrt // for the dispatch but some ring type (like Gmpz) provides a Sqrt

View File

@ -40,7 +40,6 @@
namespace CGAL { namespace CGAL {
// AST for mpq_class // AST for mpq_class
template<> template<>
class Algebraic_structure_traits< mpq_class > class Algebraic_structure_traits< mpq_class >