From 455d80c8a6a67f02adf83d3e69e4fab111031e18 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Sun, 10 Feb 2019 15:29:25 +0100 Subject: [PATCH] Handle computations the same as constructions. --- NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h | 10 +++++----- NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h index 0fa5fa99d43..8385d6c42f4 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h @@ -63,7 +63,6 @@ namespace internal { } // Whenever a construction takes iterator pairs as input, whether they point to double of Lazy objects, copy the ranges inside the lazy result so they are available for update_exact(). We analyze the input to try and guess where iterator pairs are. I would prefer if each functor had a specific signature (no overload in this layer) so we wouldn't have to guess. -// FIXME: Lazy_construct_nt is also a construction and needs the same treatment. namespace Lazy_internal { templatestruct typelist{}; templatestruct arg_i{}; @@ -155,13 +154,14 @@ class Lazy_rep_XXX : } // TODO: print_dag needs a specific implementation for Lazy_rep_XXX }; +templatestruct Select_converter { typedef typename LK::E2A type; }; +templatestruct Select_converter { typedef To_interval type; }; template struct Lazy_construction2 { static const bool Protection = true; typedef typename LK::Approximate_kernel AK; typedef typename LK::Exact_kernel EK; - typedef typename LK::E2A E2A; typedef typename Get_functor::type AC; typedef typename Get_functor::type EC; typedef typename map_result_tag::type result_tag; @@ -169,6 +169,7 @@ struct Lazy_construction2 { typedef typename Get_type::type ET; typedef typename Get_type::type result_type; // same as Handle = Lazy< AT, ET, E2A> + typedef typename Select_converter::type, LK, ET>::type E2A; Lazy_construction2(){} Lazy_construction2(LK const&k):ac(k.approximate_kernel()),ec(k.exact_kernel()){} @@ -225,6 +226,7 @@ struct Lazy_cartesian_types typedef typename Select_nth_element_functor::type AF; typedef typename Select_nth_element_functor::type EF; + // TODO: we should use Lazy_construction2, but this seems ok for now, we never construct iterators from iterators. typedef typename internal::Lazy_construction_maybe_nt< Kernel_, AF, EF, is_NT_tag::value >::type nth_elem; @@ -298,9 +300,7 @@ struct Lazy_cartesian : typedef Filtered_predicate2 type; }; template struct Functor { - typedef typename Get_functor::type FA; - typedef typename Get_functor::type FE; - typedef Lazy_construction_nt type; + typedef Lazy_construction2 type; }; template struct Functor { typedef Lazy_construction2 type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h index 58fbef78dd7..ebe4eae4382 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_tags.h @@ -199,7 +199,11 @@ namespace CGAL { typedef Null_tag value_tag; }; + templatestruct map_result_tag{typedef Null_type type;}; + templatestruct map_result_tag >{typedef T type;}; + #define CGAL_DECL_COMPUTE(X) struct X##_tag {}; \ + template<>struct map_result_tag{typedef FT_tag type;}; \ templatestruct Get_functor_category{typedef Compute_tag type;} CGAL_DECL_COMPUTE(Compute_point_cartesian_coordinate); CGAL_DECL_COMPUTE(Compute_vector_cartesian_coordinate); @@ -237,9 +241,6 @@ namespace CGAL { CGAL_DECL_ITER_OBJ(Point_cartesian_const_iterator, FT, Compute_point_cartesian_coordinate, Point); #undef CGAL_DECL_ITER_OBJ - templatestruct map_result_tag{typedef Null_type type;}; - templatestruct map_result_tag >{typedef T type;}; - templatestruct Get_functor_category,B,C> : boost::mpl::if_c::is_iterator, Construct_iterator_tag,