From fa6818b7ddaf951f2b2ec79eeedddffca7116b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 6 Apr 2021 19:43:42 +0200 Subject: [PATCH] Fix approximate_sqrt return types --- Algebraic_foundations/include/CGAL/number_utils.h | 10 ++++++---- Number_types/include/CGAL/mpq_class.h | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Algebraic_foundations/include/CGAL/number_utils.h b/Algebraic_foundations/include/CGAL/number_utils.h index d29434ad603..3b7a1154cc8 100644 --- a/Algebraic_foundations/include/CGAL/number_utils.h +++ b/Algebraic_foundations/include/CGAL/number_utils.h @@ -302,19 +302,21 @@ to_interval( const Real_embeddable& x) { } template -NT approximate_sqrt(const NT& nt, CGAL::Null_functor) +typename Coercion_traits::Type +approximate_sqrt(const NT& x, CGAL::Null_functor) { - return NT(sqrt(CGAL::to_double(nt))); + return sqrt(CGAL::to_double(x)); } template -NT approximate_sqrt(const NT& nt, Sqrt sqrt) +typename Sqrt::result_type +approximate_sqrt(const NT& nt, Sqrt sqrt) { return sqrt(nt); } template -NT approximate_sqrt(const NT& nt) +decltype(auto) approximate_sqrt(const NT& nt) { // the initial version of this function was using Algebraic_category // for the dispatch but some ring type (like Gmpz) provides a Sqrt diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index 6250ea95e3a..76611b93cf9 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -40,7 +40,6 @@ namespace CGAL { - // AST for mpq_class template<> class Algebraic_structure_traits< mpq_class >