From fe1fd95d23146824db08b95eaf8d6629bd3e8d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 9 Mar 2020 15:31:51 +0100 Subject: [PATCH 1/6] Fix always returning by copy when it is possible to return by reference --- Triangulation_2/include/CGAL/Triangulation_2.h | 15 +++++---------- Triangulation_3/include/CGAL/Triangulation_3.h | 6 ++++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 16e355c20e4..16e9918519e 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -128,6 +128,8 @@ public: typedef typename Tds::Halfedge_iterator All_halfedges_iterator; typedef typename Tds::Vertex_iterator All_vertices_iterator; + typedef typename Gt::Construct_point_2 Construct_point_2; + class Perturbation_order { const Self *t; @@ -277,7 +279,9 @@ public: Face_handle &fr) const; // GEOMETRIC FEATURES AND CONSTRUCTION - Point_2 construct_point(const Point& p) const; + typename boost::result_of::type + construct_point(const Point& p) const { return geom_traits().construct_point_2_object()(p); } + const Point& point(Face_handle c, int i) const; const Point& point(Vertex_handle v) const; Segment segment(Face_handle f, int i) const; @@ -595,7 +599,6 @@ std::ptrdiff_t insert(InputIterator first, InputIterator last) std::vector points (first, last); - typedef typename Geom_traits::Construct_point_2 Construct_point_2; typedef typename boost::result_of::type Ret; typedef CGAL::internal::boost_::function_property_map fpmap; typedef CGAL::Spatial_sort_traits_adapter_2 Search_traits_2; @@ -967,14 +970,6 @@ is_face(Vertex_handle v1, return _tds.is_face(v1, v2, v3, fr); } -template -typename Triangulation_2::Point_2 -Triangulation_2:: -construct_point(const Point& p) const -{ - return geom_traits().construct_point_2_object()(p); -} - template const typename Triangulation_2::Point& Triangulation_2:: diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 2e3771adad4..ebe2a7de594 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -433,6 +433,8 @@ public: typedef typename Tds::Simplex Simplex; + typedef typename GT::Construct_point_3 Construct_point_3; + private: // This class is used to generate the Finite_*_iterators. class Infinite_tester @@ -553,7 +555,8 @@ protected: public: template // Point or Point_3 - Point_3 construct_point(const P& p) const + typename boost::result_of::type + construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); } @@ -1127,7 +1130,6 @@ public: // Nevertheless, to make it more generic (that is, allowing the user to pass // a `Point` type that is not GT::Point_3), we still use the spatial sort // adapter traits and Construct_point_3 here. - typedef typename Geom_traits::Construct_point_3 Construct_point_3; typedef typename boost::result_of::type Ret; typedef CGAL::internal::boost_::function_property_map fpmap; typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; From 77a0115dc4c74eccdb58cccc87af2574bdbeb568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 9 Mar 2020 16:32:54 +0100 Subject: [PATCH 2/6] Add missing 'const' --- .../Periodic_3_Delaunay_triangulation_remove_traits_3.h | 2 +- .../internal/Periodic_3_regular_triangulation_remove_traits_3.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h index 7da23411dbf..5594fdffcab 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h @@ -49,7 +49,7 @@ public: using Base::operator(); - const Point_3& operator()(const Point_3& p) { return p; } + const Point_3& operator()(const Point_3& p) const { return p; } }; template < class Traits_, class Functor_ > diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h index 5f4afedc50c..b104ff7f523 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h @@ -58,7 +58,7 @@ public: using Base::operator(); // for K::Weighted_point_3 to Point_3 - Point_3 operator()(const Weighted_point_3& wp) { + Point_3 operator()(const Weighted_point_3& wp) const { return std::make_pair(operator()(wp.first), wp.second /* offset */); } }; From adec4123a03160c9f6defa6a3d68376634eeca16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 9 Mar 2020 16:33:08 +0100 Subject: [PATCH 3/6] Take return of construct_point by reference when possible --- .../include/CGAL/Periodic_3_triangulation_3.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index a44ef206fa9..0d456daa3b8 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -659,7 +659,8 @@ public: // but point() -like functions have return type Point template // can be Point or Point_3 - Point_3 construct_point(const P& p) const { + typename boost::result_of::type + construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); } From 5a3d877892806534704c02f9e8747393476ecb4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 9 Mar 2020 16:35:52 +0100 Subject: [PATCH 4/6] Add #include for boost::result_of --- .../include/CGAL/Periodic_3_triangulation_3.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 0d456daa3b8..efd005be8d4 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -30,11 +30,6 @@ #include -#include -#include -#include -#include -#include #include #include #include @@ -57,6 +52,13 @@ #include #endif // no CGAL_NO_STRUCTURAL_FILTERING +#include +#include +#include +#include +#include +#include + #include #include #include From 2ee69c240b42d7ea4b86801be439a5dca93e472c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 12:03:47 +0100 Subject: [PATCH 5/6] Add Construct_point_2 to APL2 traits models The traits is supposed to be a model of a concept which refines TriangulationTraits2, which demands a model of ConstructPoint_2, so it should have been there. --- .../include/CGAL/Apollonius_graph_filtered_traits_2.h | 5 +++++ Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h index cc522fc8d72..11ece20161c 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h @@ -174,6 +174,7 @@ public: //--------------------------------- typedef typename CK_traits::Construct_object_2 Construct_object_2; typedef typename CK_traits::Assign_2 Assign_2; + typedef typename CK_traits::Construct_point_2 Construct_point_2; // CONSTRUCTIONS //-------------- @@ -338,6 +339,10 @@ public: return Construct_object_2(); } + Construct_point_2 + construct_point_2_object() const { + return Construct_point_2(); + } // CONSTRUCTIONS //-------------- diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h index 05bb1102918..4ebf84eddc1 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h @@ -84,6 +84,8 @@ public: // CONSTRUCTIONS //-------------- + typedef typename Kernel::Construct_point_2 Construct_point_2; + // vertex and dual site typedef CGAL_APOLLONIUS_GRAPH_2_NS::Construct_Apollonius_vertex_2 /* */ Construct_Apollonius_vertex_2; @@ -151,6 +153,10 @@ public: return Construct_object_2(); } + Construct_point_2 + construct_point_2_object() const { + return Construct_point_2(); + } // CONSTRUCTIONS //-------------- From 2cfad7b9914bc2fbdda971a5931812c2321c73e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 10 Mar 2020 12:24:31 +0100 Subject: [PATCH 6/6] Add Construct_point_2 to SDG2 traits models The traits is supposed to be a model of a concept which refines TriangulationTraits2, which demands a model of ConstructPoint_2, so it should have been there. --- .../CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h | 6 ++++++ .../include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h index 426746d4130..1867aaa5d71 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Filtered_traits_base_2.h @@ -177,6 +177,7 @@ public: //--------------------------------- typedef typename CK::Construct_object_2 Construct_object_2; typedef typename CK::Assign_2 Assign_2; + typedef typename CK::Construct_point_2 Construct_point_2; // CONSTRUCTIONS //-------------- @@ -376,6 +377,11 @@ public: return Construct_object_2(); } + Construct_point_2 + construct_point_2_object() const { + return Construct_point_2(); + } + // CONSTRUCTIONS //-------------- Construct_svd_vertex_2 diff --git a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h index 00e232de6d4..a94164ef197 100644 --- a/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h +++ b/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Traits_base_2.h @@ -105,6 +105,7 @@ public: //------------------------------- typedef typename Kernel::Construct_object_2 Construct_object_2; typedef typename Kernel::Assign_2 Assign_2; + typedef typename Kernel::Construct_point_2 Construct_point_2; // CONSTRUCTIONS //-------------- @@ -195,6 +196,11 @@ public: return Construct_object_2(); } + Construct_point_2 + construct_point_2_object() const { + return Construct_point_2(); + } + // CONSTRUCTIONS //-------------- Construct_svd_vertex_2