From bfbba261242cf5f988b91b4cb4506eeddeba00b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 1 Dec 2016 11:33:46 +0100 Subject: [PATCH] Fixed a compilation issue in PMP's border_halfedges() Previous code did not compile if a face index map was not given in named parameters, nor as an internal property map --- .../CGAL/Polygon_mesh_processing/border.h | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/border.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/border.h index d2a32ef85f5..6c21d02b1f5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/border.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/border.h @@ -80,11 +80,13 @@ namespace Polygon_mesh_processing { template + , typename HalfedgeOutputIterator + , typename NamedParameters> HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces , typename boost::cgal_no_property::type , HalfedgeOutputIterator out - , const PM& pmesh) + , const PM& pmesh + , const NamedParameters& /* np */) { return border_halfedges_impl(faces, out, pmesh); } @@ -92,15 +94,31 @@ namespace Polygon_mesh_processing { template + , typename HalfedgeOutputIterator + , typename NamedParameters> HalfedgeOutputIterator border_halfedges_impl(const FaceRange& faces , const FaceIndexMap& fmap , HalfedgeOutputIterator out - , const PM& pmesh) + , const PM& pmesh + , const NamedParameters& /* np */) { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; + //make a minimal check that it's properly initialized : + //if the 2 first faces have the same id, we know the property map is not initialized + if (boost::is_same::Is_internal_map, + boost::true_type>::value) + { + typename boost::range_iterator::type it = boost::const_begin(faces); + if (get(fmap, *it) == get(fmap, *cpp11::next(it))) + { + std::cerr << "WARNING : the internal property map for CGAL::face_index_t" << std::endl + << " is not properly initialized." << std::endl + << " Initialize it before calling border_halfedges()" << std::endl; + } + } + std::vector present(num_faces(pmesh), false); BOOST_FOREACH(face_descriptor fd, faces) present[get(fmap, fd)] = true; @@ -184,21 +202,7 @@ namespace Polygon_mesh_processing { FIMap fim = choose_param(get_param(np, CGAL::face_index), get_const_property_map(CGAL::face_index, pmesh)); - //make a minimal check that it's properly initialized : - //if the 2 first faces have the same id, we know the property map is not initialized - if (boost::is_same::Is_internal_map, - boost::true_type>::value) - { - typename boost::range_iterator::type it = boost::const_begin(faces); - if (get(fim, *it) == get(fim, *cpp11::next(it))) - { - std::cerr << "WARNING : the internal property map for CGAL::face_index_t" << std::endl - << " is not properly initialized." << std::endl - << " Initialize it before calling border_halfedges()" << std::endl; - } - } - - return internal::border_halfedges_impl(faces, fim, out, pmesh); + return internal::border_halfedges_impl(faces, fim, out, pmesh, np); } template