From b51b4d87130682ea726cda7641b33fe150f0906e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 13 Feb 2023 16:04:33 +0100 Subject: [PATCH] Fix SLS iterators to actually handle all possible models --- .../Straight_skeleton_2/Polygon_iterators.h | 95 +++++++++---------- 1 file changed, 44 insertions(+), 51 deletions(-) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h index 4740194987b..8e63332b913 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_iterators.h @@ -13,72 +13,65 @@ #include -#include - #include +#include + namespace CGAL { namespace CGAL_SS_i { // to distinguish between SequenceContainers of points, and GeneralPolygonWithHoles_2 BOOST_MPL_HAS_XXX_TRAIT_DEF(Hole_const_iterator) -// Generic container -template -inline typename Poly::const_iterator vertices_begin ( Poly const& aPoly ) -{ return aPoly.begin() ; } +// Polygon_2-type container +template +inline typename Poly::const_iterator +vertices_begin(const Poly& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly.begin(); } -template -inline typename Poly::const_iterator vertices_end ( Poly const& aPoly ) -{ return aPoly.end() ; } +template +inline typename Poly::const_iterator +vertices_end(const Poly& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly.end(); } -template -inline typename Poly::const_iterator vertices_begin ( boost::shared_ptr const& aPoly ) -{ return aPoly->begin() ; } +template +inline typename Poly::const_iterator +vertices_begin(const boost::shared_ptr& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly->begin(); } -template -inline typename Poly::const_iterator vertices_end ( boost::shared_ptr const& aPoly ) -{ return aPoly->end() ; } +template +inline typename Poly::const_iterator +vertices_end(const boost::shared_ptr & aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly->end(); } -// Polygon_2 -template -inline typename Polygon_2::Vertex_const_iterator -vertices_begin ( Polygon_2 const& aPoly ) -{ return aPoly.vertices_begin() ; } +// Polygon_with_holes_2-type container +template +inline typename PolyWithHoles::Polygon_2::const_iterator +vertices_begin(const PolyWithHoles& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly.outer_boundary().begin(); } -template -inline typename Polygon_2::Vertex_const_iterator -vertices_end( Polygon_2 const& aPoly ) -{ return aPoly.vertices_end() ; } +template +inline typename PolyWithHoles::Polygon_2::const_iterator +vertices_end(const PolyWithHoles& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly.outer_boundary().end(); } -template -inline typename Polygon_2::Vertex_const_iterator vertices_begin ( boost::shared_ptr > const& aPoly ) -{ return aPoly->vertices_begin() ; } +template +inline typename PolyWithHoles::Polygon_2::const_iterator +vertices_begin(const boost::shared_ptr& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly->outer_boundary().begin(); } -template -inline typename Polygon_2::Vertex_const_iterator vertices_end( boost::shared_ptr > const& aPoly ) -{ return aPoly->vertices_end() ; } - -// Polygon_with_holes_2 -template -inline typename Polygon_with_holes_2::Polygon_2::Vertex_const_iterator -vertices_begin ( Polygon_with_holes_2 const& aPoly ) -{ return aPoly.outer_boundary().vertices_begin() ; } - -template -inline typename Polygon_with_holes_2::Polygon_2::Vertex_const_iterator -vertices_end( Polygon_with_holes_2 const& aPoly ) -{ return aPoly.outer_boundary().vertices_end() ; } - -template -inline typename Polygon_with_holes_2::Polygon_2::Vertex_const_iterator -vertices_begin ( boost::shared_ptr > const& aPoly ) -{ return aPoly->outer_boundary().vertices_begin() ; } - -template -inline typename Polygon_with_holes_2::Polygon_2::Vertex_const_iterator -vertices_end( boost::shared_ptr > const& aPoly ) -{ return aPoly->outer_boundary().vertices_end() ; } +template +inline typename PolyWithHoles::Polygon_2::const_iterator +vertices_end(const boost::shared_ptr& aPoly, + std::enable_if_t::value>* = nullptr) +{ return aPoly->outer_boundary().end(); } } // namespace CGAL_SS_i } // namespace CGAL