From df560987a63b95680d944d028a96ba818d7f63de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 8 Oct 2021 12:13:43 +0200 Subject: [PATCH 1/9] Whitespace & cleaning changes --- .../AABB_triangulation_3_cell_primitive.h | 4 +- .../bgl_dual_adapter.cpp | 3 +- .../BGL_arrangement_2/arrangement_dual.cpp | 6 +-- .../graph/Graph_with_descriptor_with_graph.h | 4 +- .../boost/graph/alpha_expansion_graphcut.h | 1 - BGL/include/CGAL/boost/graph/properties.h | 2 +- .../CGAL/boost/graph/properties_OpenMesh.h | 13 +++---- BGL/include/CGAL/boost/graph/property_maps.h | 1 + Hash_map/include/CGAL/Unique_hash_map.h | 13 ++++--- .../Mesh_domain_with_polyline_features_3.h | 6 ++- .../include/CGAL/Point_with_normal_3.h | 3 +- .../include/CGAL/structure_point_set.h | 5 ++- .../Isotropic_remeshing/remesh_impl.h | 6 +-- .../remeshing_test.cpp | 3 +- .../polyfit_example_with_region_growing.cpp | 16 ++++---- .../Plugins/AABB_tree/Cut_plugin.cpp | 9 +---- .../Scene_edit_polyhedron_item.cpp | 2 + .../Scene_edit_polyhedron_item.h | 8 ++-- .../demo/Polyhedron/include/id_printing.h | 22 ++++++----- .../graph/properties_Polyhedron_3_features.h | 4 +- .../properties_Polyhedron_3_time_stamp.h | 3 +- Property_map/include/CGAL/property_map.h | 26 ++++++------- .../region_growing_with_custom_classes.cpp | 11 +++--- .../Region_growing/internal/property_map.h | 38 +++++++------------ .../boost/graph/properties_Surface_mesh.h | 6 +-- .../tetrahedral_remeshing_with_features.cpp | 2 +- ...st_tetrahedral_remeshing_with_features.cpp | 2 +- 27 files changed, 105 insertions(+), 114 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 66783dcff9b..30bc22a98d4 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -55,8 +55,8 @@ namespace CGAL typedef boost::readable_property_map_tag category; inline friend - reference - get(Tet_from_cell_iterator_proprety_map, key_type it) + reference + get(Tet_from_cell_iterator_proprety_map, key_type it) { typename GeomTraits::Construct_point_3 point; return value_type(point(it->vertex(0)->point()), diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp index 25edcebecc1..6b24532b2aa 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_dual_adapter.cpp @@ -17,7 +17,8 @@ // A property map that reads/writes the information to/from the extended // face. -template class Extended_face_property_map { +template +class Extended_face_property_map { public: typedef typename Arrangement::Face_handle Face_handle; diff --git a/BGL/examples/BGL_arrangement_2/arrangement_dual.cpp b/BGL/examples/BGL_arrangement_2/arrangement_dual.cpp index 19cc0702267..dcf4acab64e 100644 --- a/BGL/examples/BGL_arrangement_2/arrangement_dual.cpp +++ b/BGL/examples/BGL_arrangement_2/arrangement_dual.cpp @@ -17,7 +17,8 @@ // A property map that reads/writes the information to/from the extended // face. -template class Extended_face_property_map { +template +class Extended_face_property_map { public: typedef typename Arrangement::Face_handle Face_handle; @@ -32,8 +33,7 @@ public: { return key->data(); } // The put function is required by the property map concept. - friend void put(const Extended_face_property_map&, - key_type key, value_type val) + friend void put(const Extended_face_property_map&, key_type key, value_type val) { key->set_data(val); } }; diff --git a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h index c268aff6466..697d26173ca 100644 --- a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h +++ b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h @@ -727,7 +727,7 @@ struct Graph_with_descriptor_with_graph_property_map { template friend void - put(const Graph_with_descriptor_with_graph_property_map& gpm, const Descriptor& d, const value_type& v) + put(const Graph_with_descriptor_with_graph_property_map& gpm, const Descriptor& d, const value_type& v) { CGAL_assertion(gpm.graph!=nullptr); CGAL_assertion(d.graph == gpm.graph); @@ -749,7 +749,7 @@ struct Graph_with_descriptor_with_graph_property_map::const_type Edge_cost_map; diff --git a/BGL/include/CGAL/boost/graph/properties.h b/BGL/include/CGAL/boost/graph/properties.h index 9774e1ac39f..9c0b488d6dd 100644 --- a/BGL/include/CGAL/boost/graph/properties.h +++ b/BGL/include/CGAL/boost/graph/properties.h @@ -135,7 +135,7 @@ struct Point_accessor : boost::put_get_helper< ConstReference, Point_accessor > { typedef boost::lvalue_property_map_tag category; - typedef ConstReference reference; + typedef ConstReference reference; typedef ValueType value_type; typedef Handle key_type; diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index d4839468ffe..6cd42d3b884 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -41,7 +41,6 @@ public: typedef Descriptor key_type; typedef Value value_type; - typedef value_type& reference; OM_pmap() @@ -66,19 +65,19 @@ public: } inline friend reference get(const OM_pmap& pm, - typename boost::graph_traits::face_descriptor k) + typename boost::graph_traits::face_descriptor k) { return pm.mesh->property(pm.h,k); } inline friend reference get(const OM_pmap& pm, - typename boost::graph_traits::halfedge_descriptor k) + typename boost::graph_traits::halfedge_descriptor k) { return pm.mesh->property(pm.h,k); } inline friend reference get(const OM_pmap& pm, - typename boost::graph_traits::edge_descriptor k) + typename boost::graph_traits::edge_descriptor k) { typename Mesh::EdgeHandle eh(k.idx()); return pm.mesh->property(pm.h,eh); @@ -159,8 +158,8 @@ class OM_index_pmap : public boost::put_get_helper -class OM_point_pmap //: public boost::put_get_helper > +class OM_point_pmap { public: typedef boost::read_write_property_map_tag category; diff --git a/BGL/include/CGAL/boost/graph/property_maps.h b/BGL/include/CGAL/boost/graph/property_maps.h index 16da1516c87..bea0f92725f 100644 --- a/BGL/include/CGAL/boost/graph/property_maps.h +++ b/BGL/include/CGAL/boost/graph/property_maps.h @@ -196,6 +196,7 @@ struct Source_point_from_edge_descriptor_map{ typedef typename boost::property_traits< VertexPointMap >::reference reference; typedef typename boost::graph_traits::edge_descriptor key_type; typedef boost::readable_property_map_tag category; + //data typename boost::remove_const::type* m_pm; VertexPointMap m_vpm; diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index e67caeebee6..5b6b50d8fb5 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -135,6 +135,7 @@ namespace boost { typedef ValueType value_type; typedef const value_type& reference; typedef lvalue_property_map_tag category; + associative_property_map() : m_c(0) { } associative_property_map(C& c) : m_c(&c) { } value_type& operator[](const key_type& k) const { @@ -148,12 +149,12 @@ namespace boost { return uhm[key]; } - friend - void - put(associative_property_map& uhm, const key_type& key, const value_type& val) - { - uhm[key] = val; - } + friend + void + put(associative_property_map& uhm, const key_type& key, const value_type& val) + { + uhm[key] = val; + } private: C* m_c; diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 9a35bf41a70..604d3e8ab84 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -1117,7 +1117,8 @@ add_features(InputIterator first, InputIterator end, namespace details { template -struct Get_content_from_polyline_with_context { +struct Get_content_from_polyline_with_context +{ typedef Get_content_from_polyline_with_context Self; typedef const PolylineWithContext& key_type; typedef const typename PolylineWithContext::Bare_polyline& value_type; @@ -1129,7 +1130,8 @@ struct Get_content_from_polyline_with_context { }; // end Get_content_from_polyline_with_context template -struct Get_patches_id_from_polyline_with_context { +struct Get_patches_id_from_polyline_with_context +{ typedef Get_patches_id_from_polyline_with_context Self; typedef const PolylineWithContext& key_type; typedef const typename PolylineWithContext::Context::Patches_ids& value_type; diff --git a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h index b2765e116fe..c223cdad6ba 100644 --- a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h +++ b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h @@ -128,6 +128,8 @@ private: template struct Normal_of_point_with_normal_map { + typedef Normal_of_point_with_normal_map Self; + typedef Point_with_normal_3 Point_with_normal; ///< Position + normal typedef typename Gt::Vector_3 Vector; /// normal @@ -139,7 +141,6 @@ struct Normal_of_point_with_normal_map /// Access a property map element value_type& operator[](key_type& pwn) const { return pwn.normal(); } - typedef Normal_of_point_with_normal_map Self; /// \name Put/get free functions /// @{ friend reference get(const Self&,const key_type& k) {return k.normal();} diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index 296028eaff4..1f90cf36cd1 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -102,10 +102,11 @@ private: typedef const value_type& reference; typedef std::size_t key_type; typedef boost::lvalue_property_map_tag category; + My_point_property_map (const std::vector& pts) : points (pts) {} + reference operator[] (key_type k) const { return points[k]; } - friend inline reference get (const My_point_property_map& ppmap, key_type i) - { return ppmap[i]; } + friend inline reference get (const My_point_property_map& ppmap, key_type i) { return ppmap[i]; } }; struct Edge diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 855309a1f7a..176dadb3fb1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1124,9 +1124,9 @@ private: struct Patch_id_property_map { - typedef boost::readable_property_map_tag category; - typedef Patch_id value_type; - typedef Patch_id& reference; + typedef boost::readable_property_map_tag category; + typedef Patch_id value_type; + typedef Patch_id& reference; typedef typename Triangle_list::const_iterator key_type; const Self* remesher_ptr_; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp index 071ee35eb0b..a588f252b4c 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp @@ -139,8 +139,7 @@ public: return !map.set_ptr_->empty() && map.set_ptr_->count(e); } - friend void put(Constraints_pmap& map - , const key_type& e, const value_type is) + friend void put(Constraints_pmap& map, const key_type& e, const value_type is) { CGAL_assertion(map.set_ptr_ != NULL); if (is) map.set_ptr_->insert(e); diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp index 8602fcd4919..483e3bc93e3 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp @@ -58,20 +58,18 @@ public: Index_map() { } template - Index_map( - const PointRange& points, - const std::vector< std::vector >& regions) : - m_indices(new std::vector(points.size(), -1)) { - + Index_map(const PointRange& points, + const std::vector< std::vector >& regions) + : m_indices(new std::vector(points.size(), -1)) + { for (std::size_t i = 0; i < regions.size(); ++i) for (const std::size_t idx : regions[i]) (*m_indices)[idx] = static_cast(i); } - inline friend value_type get( - const Index_map& index_map, - const key_type key) { - + inline friend value_type get(const Index_map& index_map, + const key_type key) + { const auto& indices = *(index_map.m_indices); return indices[key]; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp index c47593831be..ffb89019ab9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/AABB_tree/Cut_plugin.cpp @@ -204,14 +204,9 @@ struct PPMAP typedef typename boost::property_map::type VertexPointMap; Mesh* _mesh; - PPMAP() - :_mesh(NULL){} - PPMAP(Mesh* mesh) - :_mesh(mesh) - { - } - + PPMAP() :_mesh(NULL){} + PPMAP(Mesh* mesh) :_mesh(mesh) { } friend reference get(const PPMAP&ppmap, key_type v) { diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index c6ab13f76f6..09890b87bda 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -528,8 +528,10 @@ struct Is_constrained_map typedef bool value_type; typedef bool reference; typedef boost::read_write_property_map_tag category; + SMesh::Property_map icmap; SMesh* mesh; + Is_constrained_map() {} Is_constrained_map(std::vector* vec, SMesh* mesh) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h index a5db1cb3f62..a2f8487b74c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h @@ -73,17 +73,19 @@ struct Array_based_vertex_point_map { public: typedef typename boost::graph_traits::vertex_descriptor key_type; - typedef EPICK::Point_3 value_type; + typedef EPICK::Point_3 value_type; typedef const value_type& reference; typedef boost::read_write_property_map_tag category; + std::vector* positions; Mesh* mesh; Id_setter* id_setter; - Array_based_vertex_point_map(std::vector* positions, Mesh* mesh, Id_setter* id_setter) : positions(positions), mesh(mesh), id_setter(id_setter) {} + Array_based_vertex_point_map(std::vector* positions, Mesh* mesh, Id_setter* id_setter) + : positions(positions), mesh(mesh), id_setter(id_setter) + {} }; - template inline typename Array_based_vertex_point_map::reference get(Array_based_vertex_point_map map, diff --git a/Polyhedron/demo/Polyhedron/include/id_printing.h b/Polyhedron/demo/Polyhedron/include/id_printing.h index b3ad4bb8648..46d142a24bb 100644 --- a/Polyhedron/demo/Polyhedron/include/id_printing.h +++ b/Polyhedron/demo/Polyhedron/include/id_printing.h @@ -7,7 +7,9 @@ #include #include #include + #define POINT_SIZE 11 + template struct VKRingPMAP{ typedef typename boost::graph_traits::vertex_descriptor key_type; @@ -15,22 +17,22 @@ struct VKRingPMAP{ typedef value_type reference; typedef boost::read_write_property_map_tag category; typedef typename boost::property_map::type IDmap; + std::vector* vec; Mesh* poly; IDmap idmap; - VKRingPMAP(std::vector* vec, Mesh* poly) :vec(vec), poly(poly) { idmap = get(boost::vertex_index, *poly); } - friend value_type get(const VKRingPMAP& map, const key_type& f){ - return (*map.vec)[get(map.idmap, f)]; + friend value_type get(const VKRingPMAP& map, const key_type& v){ + return (*map.vec)[get(map.idmap, v)]; } - friend void put(VKRingPMAP& map, const key_type& f, const value_type i){ - (*map.vec)[get(map.idmap, f)] = i; + friend void put(VKRingPMAP& map, const key_type& v, const value_type i){ + (*map.vec)[get(map.idmap, v)] = i; } }; template @@ -40,6 +42,7 @@ struct EdgeKRingPMAP{ typedef value_type reference; typedef boost::read_write_property_map_tag category; typedef typename boost::property_map::type IDmap; + std::vector* vec; Mesh* poly; IDmap idmap; @@ -50,11 +53,11 @@ struct EdgeKRingPMAP{ idmap = get(boost::halfedge_index, *poly); } - friend value_type get(const EdgeKRingPMAP& map, const key_type& f){ - return (*map.vec)[get(map.idmap, halfedge(f, *map.poly))/2]; + friend value_type get(const EdgeKRingPMAP& map, const key_type& e){ + return (*map.vec)[get(map.idmap, halfedge(e, *map.poly))/2]; } - friend void put(EdgeKRingPMAP& map, const key_type& f, const value_type i){ - (*map.vec)[get(map.idmap, halfedge(f, *map.poly))/2] = i; + friend void put(EdgeKRingPMAP& map, const key_type& e, const value_type i){ + (*map.vec)[get(map.idmap, halfedge(e, *map.poly))/2] = i; } }; template @@ -64,6 +67,7 @@ struct FKRingPMAP{ typedef value_type reference; typedef boost::read_write_property_map_tag category; typedef typename boost::property_map::type IDmap; + std::vector* vec; Mesh* poly; IDmap idmap; diff --git a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h index b74fd55f97c..63ad423c9c6 100644 --- a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h +++ b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h @@ -50,8 +50,7 @@ Patch_id get(Polyhedron_face_patch_id_pmap, Handle_type h) } template -void put(Polyhedron_face_patch_id_pmap, Handle_type h, - Patch_id pid) +void put(Polyhedron_face_patch_id_pmap, Handle_type h, Patch_id pid) { h->set_patch_id(pid); } @@ -203,7 +202,6 @@ struct Polyhedron_incident_patches_pmap { { return get(*this, h); } - }; template diff --git a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_time_stamp.h b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_time_stamp.h index 902926c9f05..cb396919506 100644 --- a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_time_stamp.h +++ b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_time_stamp.h @@ -33,8 +33,7 @@ std::size_t get(Polyhedron_face_time_stamp_pmap, Handle_type h) } template -void put(Polyhedron_face_time_stamp_pmap, Handle_type h, - std::size_t ts) +void put(Polyhedron_face_time_stamp_pmap, Handle_type h, std::size_t ts) { h->set_time_stamp(ts); } diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 5208371a40b..6dfe472310e 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -49,7 +49,6 @@ public: typedef boost::read_write_property_map_tag category; public: - inline friend value_type get(Static_boolean_property_map, const key_type&) @@ -82,14 +81,14 @@ class OR_property_map { {} inline friend - value_type - get(const OR_property_map& pm, const key_type& k) + value_type + get(const OR_property_map& pm, const key_type& k) { return get(pm.pm1,k) || get(pm.pm2,k); } inline friend - void + void put(OR_property_map& pm, const key_type& k, const value_type& v) { put(pm.pm1,k, v); @@ -328,13 +327,14 @@ template struct Nth_of_tuple_property_map { typedef Tuple key_type; ///< typedef to `Tuple` - #ifdef DOXYGEN_RUNNING +#ifdef DOXYGEN_RUNNING typedef unspecified_type value_type; ///< typedef to the N-th type of the tuple - #else +#else typedef typename boost::tuples::element::type value_type; #endif typedef const value_type& reference; ///< typedef to `value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + /// Access a property map element. /// @param tuple a key whose Nth item is accessed value_type& operator[](key_type& tuple) const { return tuple.template get(); } @@ -342,8 +342,8 @@ struct Nth_of_tuple_property_map typedef Nth_of_tuple_property_map Self; /// \name Put/get free functions /// @{ - friend reference get(const Self&,const key_type& k) {return k.template get();} - friend void put(const Self&,key_type& k, const value_type& v) {k.template get()=v;} + friend reference get(const Self&, key_type& k) { return k.template get(); } + friend void put(const Self&, key_type& k, const value_type& v) { k.template get() = v; } /// @} }; @@ -351,6 +351,8 @@ template struct Nth_of_tuple_property_map > { typedef std::tuple Tuple; + typedef Nth_of_tuple_property_map Self; + typedef Tuple key_type; typedef typename std::tuple_element::type value_type; typedef const value_type& reference; @@ -358,9 +360,8 @@ struct Nth_of_tuple_property_map > value_type& operator[](key_type& tuple) const { return get(tuple); } - typedef Nth_of_tuple_property_map Self; - friend reference get(const Self&,const key_type& k) {return std::get(k);} - friend void put(const Self&,key_type& k, const value_type& v) {std::get(k)=v;} + friend reference get(const Self&, key_type& k) { return std::get(k); } + friend void put(const Self&, key_type& k, const value_type& v) { std::get(k) = v; } }; /// Free function to create a Nth_of_tuple_property_map property map. @@ -555,8 +556,7 @@ struct Cartesian_converter_property_map friend value_type get(const Cartesian_converter_property_map& pm, const key_type& k) { - return - CGAL::Cartesian_converter()(get(pm.vpm, k)); + return CGAL::Cartesian_converter()(get(pm.vpm, k)); } friend void put(Cartesian_converter_property_map& pm, const key_type& k, const value_type& v) diff --git a/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp b/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp index fcf77ae1a2b..c66c1503702 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp @@ -89,18 +89,17 @@ namespace Custom { using value_type = std::size_t; using category = boost::lvalue_property_map_tag; - Seed_map(const std::map& objects_map) : - m_objects_map(objects_map) + Seed_map(const std::map& objects_map) + : m_objects_map(objects_map) { } value_type operator[](const key_type key) const { return m_objects_map.find(key)->second; } - friend value_type get( - const Seed_map& seed_map, - const key_type key) { - + friend value_type get(const Seed_map& seed_map, + const key_type& key) + { return seed_map[key]; } diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h index 3ca4b0a8531..41ac0f567d9 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h @@ -57,10 +57,8 @@ namespace internal { return get(m_property_map, key); } - friend inline reference get( - const Item_property_map& item_map, - const key_type key) { - + friend inline reference get(const Item_property_map& item_map, + const key_type key) { return item_map[key]; } @@ -105,10 +103,8 @@ namespace internal { return value->second; } - friend inline value_type get( - const Item_to_index_property_map& item_to_index_map, - const key_type& key) { - + friend inline value_type get(const Item_to_index_property_map& item_to_index_map, + const key_type& key) { return item_to_index_map[key]; } @@ -124,19 +120,16 @@ namespace internal { using value_type = std::size_t; using category = boost::lvalue_property_map_tag; - Seed_property_map( - const std::vector& seeds) : - m_seeds(seeds) + Seed_property_map(const std::vector& seeds) + : m_seeds(seeds) { } value_type operator[](const key_type key) const { return m_seeds[key]; } - friend value_type get( - const Seed_property_map& seed_map, - const key_type key) { - + friend value_type get(const Seed_property_map& seed_map, + const key_type key) { return seed_map[key]; } @@ -159,20 +152,17 @@ namespace RG { Point_to_shape_index_map() { } template - Point_to_shape_index_map( - const PointRange& points, - const std::vector< std::vector >& regions) : - m_indices(new std::vector(points.size(), -1)) { - + Point_to_shape_index_map(const PointRange& points, + const std::vector< std::vector >& regions) + : m_indices(new std::vector(points.size(), -1)) + { for (std::size_t i = 0; i < regions.size(); ++i) for (const std::size_t idx : regions[i]) (*m_indices)[idx] = static_cast(i); } - inline friend value_type get( - const Point_to_shape_index_map& point_to_shape_index_map, - const key_type key) { - + inline friend value_type get(const Point_to_shape_index_map& point_to_shape_index_map, + const key_type key) { const auto& indices = *(point_to_shape_index_map.m_indices); return indices[key]; } diff --git a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h index 2f77a89eed0..f744ae3c9f2 100644 --- a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h +++ b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h @@ -39,7 +39,7 @@ public: typedef boost::readable_property_map_tag category; typedef typename CGAL::Kernel_traits::type::FT value_type; typedef value_type reference; - typedef typename SM::Edge_index key_type; + typedef typename SM::Edge_index key_type; SM_edge_weight_pmap(const CGAL::Surface_mesh& sm) : pm_(sm. template property_map< @@ -55,8 +55,8 @@ public: } private: - typename SM::template Property_map< typename SM::Vertex_index, - typename SM::Point > pm_; + typename SM::template Property_map< typename SM::Vertex_index, + typename SM::Point > pm_; const SM& sm_; }; diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_with_features.cpp b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_with_features.cpp index 9135cf65a15..384fc4c1967 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_with_features.cpp +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/tetrahedral_remeshing_with_features.cpp @@ -52,7 +52,7 @@ public: } friend value_type get(const Constrained_edges_property_map& map, - const key_type& k) + const key_type& k) { CGAL_assertion(map.m_set_ptr != NULL); CGAL_assertion(k.first < k.second); diff --git a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_with_features.cpp b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_with_features.cpp index 3ca850d78e6..e468ad831d8 100644 --- a/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_with_features.cpp +++ b/Tetrahedral_remeshing/test/Tetrahedral_remeshing/test_tetrahedral_remeshing_with_features.cpp @@ -57,7 +57,7 @@ public: } friend value_type get(const Constrained_edges_property_map& map, - const key_type& k) + const key_type& k) { CGAL_assertion(map.m_set_ptr != NULL); CGAL_assertion(k.first < k.second); From 1660611e760ed937fc0aa31ba2366763ac23cc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 8 Oct 2021 13:23:38 +0200 Subject: [PATCH 2/9] Use local typenames directly --- AABB_tree/include/CGAL/AABB_segment_primitive.h | 2 +- AABB_tree/include/CGAL/AABB_triangle_primitive.h | 2 +- AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_segment_primitive.h b/AABB_tree/include/CGAL/AABB_segment_primitive.h index 34851f55a63..9444e7c46dc 100644 --- a/AABB_tree/include/CGAL/AABB_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_segment_primitive.h @@ -37,7 +37,7 @@ namespace internal { typedef boost::readable_property_map_tag category; inline friend - typename Source_of_segment_3_iterator_property_map::reference + reference get(Source_of_segment_3_iterator_property_map, Iterator it) { return typename GeomTraits::Construct_source_3()( *it ); diff --git a/AABB_tree/include/CGAL/AABB_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_triangle_primitive.h index 5c1502d60af..ab6325846d6 100644 --- a/AABB_tree/include/CGAL/AABB_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangle_primitive.h @@ -37,7 +37,7 @@ namespace internal { typedef boost::readable_property_map_tag category; inline friend - typename Point_from_triangle_3_iterator_property_map::reference + reference get(Point_from_triangle_3_iterator_property_map, Iterator it) { return typename GeomTraits::Construct_vertex_3()( *it, 0 ); diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 30bc22a98d4..b6a3901f868 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -37,8 +37,8 @@ namespace CGAL typedef boost::readable_property_map_tag category; inline friend - typename Point_from_cell_iterator_proprety_map::reference - get(Point_from_cell_iterator_proprety_map, Iterator it) + reference + get(Point_from_cell_iterator_proprety_map, Iterator it) { typename GeomTraits::Construct_point_3 point; return point(it->vertex(1)->point()); From 590ddf801526adf47e281631d7667aac2b4f28f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 8 Oct 2021 15:38:47 +0200 Subject: [PATCH 3/9] Various fixes for pmaps: - Use `value_type` when the returned type is not a reference - Enforce `reference = value_type` if the returned type is not a reference (to avoid `typename PM::reference r = get(m, k)`, which will take a ref to a temporary if the `reference` typedef is an actualy reference) - Do not use `put_get_helper` if the property map is not a `lvalue` **mutable** property map: the `put()` is `map[k] = v`, which is broken if `operator[]` does not return a reference - The concept `boost::lvalue_property_map_tag` requires `operator[](key)`, not a reference in `get(map, key)`. You can have a readable property map returning a reference through its `get(map, key)`, but if there is no `operator[]`, it's just a `boost::readable_property_map_tag` - Some const correctness to avoid copying maps with state or heavy keys in `get(map, key)` / `put(map, key, value)` - Base the category of a wrapping pmap on what it offers instead of just forwarding the base property map's category - Tried to do something like mutable lvalue pmap: * `value_type& operator[](key&)` * `ref get(map, const key&)` * `put(map, const key&, const value_type&)` and non-mutable lvalue pmap: * `const value_type& operator[](const key&)` * `ref get(map, const key&)` but not everything fits properly... --- .../AABB_triangulation_3_cell_primitive.h | 2 +- .../bgl_primal_adapter.cpp | 2 +- BGL/examples/BGL_arrangement_2/primal.cpp | 2 +- BGL/include/CGAL/boost/graph/Dual.h | 4 +- .../graph/Graph_with_descriptor_with_graph.h | 2 +- .../boost/graph/alpha_expansion_graphcut.h | 2 +- .../CGAL/boost/graph/named_params_helper.h | 8 +-- BGL/include/CGAL/boost/graph/properties.h | 5 +- .../CGAL/boost/graph/properties_OpenMesh.h | 14 ++++-- BGL/include/CGAL/boost/graph/property_maps.h | 10 ++-- BGL/include/CGAL/boost/graph/selection.h | 6 +-- BGL/test/BGL/test_Face_filtered_graph.cpp | 6 ++- BGL/test/BGL/test_Properties.cpp | 6 +-- .../include/CGAL/Classification/Cluster.h | 1 - .../Classification/Point_set_neighborhood.h | 4 +- .../CGAL/Classification/property_maps.h | 4 +- Hash_map/include/CGAL/Unique_hash_map.h | 17 ++++--- .../examples/Jet_fitting_3/PolyhedralSurf.h | 6 +-- ...inear_cell_complex_for_combinatorial_map.h | 10 +++- Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h | 9 +++- .../Mesh_domain_with_polyline_features_3.h | 18 ++++--- Point_set_3/include/CGAL/Point_set_3.h | 4 +- .../internal/Neighbor_query.h | 2 +- .../include/CGAL/Point_with_normal_3.h | 6 +-- .../include/CGAL/estimate_scale.h | 16 +++--- .../include/CGAL/mst_orient_normals.h | 2 +- .../connected_components_example.cpp | 10 +++- .../corefinement_OM_union.cpp | 2 +- .../corefinement_consecutive_bool_op.cpp | 2 +- .../Polygon_mesh_processing/detect_features.h | 4 +- .../Isotropic_remeshing/remesh_impl.h | 8 +-- .../CGAL/Polygon_mesh_processing/locate.h | 2 +- .../connected_component_surface_mesh.cpp | 7 ++- .../remeshing_test.cpp | 2 +- .../triangulate_faces_test.cpp | 2 +- .../Point_set_normal_estimation_plugin.cpp | 5 +- .../Surface_mesh/Offset_meshing_plugin.cpp | 6 +-- .../Surface_mesh_approximation_plugin.cpp | 2 +- .../Scene_edit_polyhedron_item.cpp | 9 ++-- .../Scene_edit_polyhedron_item.h | 11 +++-- .../Scene_polyhedron_selection_item.h | 5 +- .../boost/graph/properties_Polyhedron_3.h | 19 ++++--- .../graph/properties_Polyhedron_3_features.h | 2 +- .../CGAL/Polyline_simplification_2/simplify.h | 6 ++- .../include/CGAL/Dynamic_property_map.h | 6 +-- .../include/CGAL/Index_property_map.h | 2 +- Property_map/include/CGAL/property_map.h | 49 ++++++++++--------- .../region_growing_with_custom_classes.cpp | 6 ++- .../Efficient_RANSAC/property_map.h | 2 +- .../Region_growing/internal/property_map.h | 5 +- .../nearest_neighbor_searching_inplace_50.cpp | 2 +- .../test/Spatial_searching/Point_with_info.h | 6 +-- .../boost/graph/properties_Surface_mesh.h | 15 +++++- .../include/CGAL/Surface_mesh_deformation.h | 4 +- .../edge_collapse_OpenMesh.cpp | 2 +- .../edge_collapse_constrain_sharp_edges.cpp | 5 +- ...collapse_constrained_border_polyhedron.cpp | 2 +- ...llapse_constrained_border_surface_mesh.cpp | 2 +- .../internal/Common.h | 2 +- .../internal/Edge_collapse.h | 3 +- .../tetrahedral_adaptive_remeshing_impl.h | 8 ++- ...st_tetrahedral_remeshing_with_features.cpp | 2 +- .../internal/properties_2D_triangulation.h | 16 +++--- ...roperties_Triangulation_data_structure_2.h | 19 ++++--- 64 files changed, 249 insertions(+), 181 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index b6a3901f868..f974920aa21 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -55,7 +55,7 @@ namespace CGAL typedef boost::readable_property_map_tag category; inline friend - reference + value_type get(Tet_from_cell_iterator_proprety_map, key_type it) { typename GeomTraits::Construct_point_3 point; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp index 397ee5de7ba..6c46d164eff 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bgl_primal_adapter.cpp @@ -43,7 +43,7 @@ public: } }; -double get(Edge_length_func edge_length, Arrangement_2::Halfedge_handle e) +double get(const Edge_length_func& edge_length, Arrangement_2::Halfedge_handle e) { return edge_length(e); } diff --git a/BGL/examples/BGL_arrangement_2/primal.cpp b/BGL/examples/BGL_arrangement_2/primal.cpp index ccd1ce9fb61..62d684e0c42 100644 --- a/BGL/examples/BGL_arrangement_2/primal.cpp +++ b/BGL/examples/BGL_arrangement_2/primal.cpp @@ -42,7 +42,7 @@ public: } }; -double get(Edge_length_func edge_length, Arrangement_2::Halfedge_handle e) +double get(const Edge_length_func& edge_length, Arrangement_2::Halfedge_handle e) { return edge_length(e); } diff --git a/BGL/include/CGAL/boost/graph/Dual.h b/BGL/include/CGAL/boost/graph/Dual.h index 405a2920a5c..78cc2b6c6f7 100644 --- a/BGL/include/CGAL/boost/graph/Dual.h +++ b/BGL/include/CGAL/boost/graph/Dual.h @@ -128,7 +128,7 @@ struct Dual_vertex_index_pmap{ typedef typename boost::graph_traits::face_descriptor key_type; typedef typename Property_map::value_type value_type; typedef typename Property_map::reference reference; - typedef typename Property_map::category category; + typedef boost::readable_property_map_tag category; Dual_vertex_index_pmap(const G& g) : m_pmap( get(boost::face_index, g) ) @@ -147,7 +147,7 @@ struct Dual_face_index_pmap{ typedef typename boost::graph_traits::vertex_descriptor key_type; typedef typename Property_map::value_type value_type; typedef typename Property_map::reference reference; - typedef typename Property_map::category category; + typedef boost::readable_property_map_tag category; Dual_face_index_pmap(const G& g) : m_pmap( get(boost::vertex_index, g) ) diff --git a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h index 697d26173ca..3ab9f38e2ef 100644 --- a/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h +++ b/BGL/include/CGAL/boost/graph/Graph_with_descriptor_with_graph.h @@ -747,7 +747,7 @@ struct Graph_with_descriptor_with_graph_property_map out; out.reserve (pmap.cost_matrix->size()); diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 4f589134439..a36ab229fe2 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -281,7 +281,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa typedef boost::readable_property_map_tag category; typedef DummyNormalPmap Self; - friend reference get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; } + friend value_type get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; } }; public: @@ -412,7 +412,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa typedef boost::read_write_property_map_tag category; typedef DummyNormalMap Self; - friend reference get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; } + friend value_type get(const Self&, const key_type&) { return CGAL::NULL_VECTOR; } friend void put(const Self&, const key_type&, const value_type&) { } }; @@ -456,7 +456,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa typedef boost::readable_property_map_tag category; typedef DummyPlaneIndexMap Self; - friend reference get(const Self&, const key_type&) { return -1; } + friend value_type get(const Self&, const key_type&) { return -1; } }; public: @@ -479,7 +479,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa typedef boost::readable_property_map_tag category; typedef DummyConstrainedMap Self; - friend reference get(const Self&, const key_type&) { return false; } + friend value_type get(const Self&, const key_type&) { return false; } }; public: diff --git a/BGL/include/CGAL/boost/graph/properties.h b/BGL/include/CGAL/boost/graph/properties.h index 9c0b488d6dd..90149829e99 100644 --- a/BGL/include/CGAL/boost/graph/properties.h +++ b/BGL/include/CGAL/boost/graph/properties.h @@ -105,14 +105,15 @@ struct Index_accessor template struct Edge_index_accessor - : boost::put_get_helper< std::size_t, Edge_index_accessor > { typedef boost::readable_property_map_tag category; typedef std::size_t reference; typedef std::size_t value_type; typedef Handle key_type; - reference operator[](Handle h) const { return h.id(); } + value_type operator[](Handle h) const { return h.id(); } + + friend inline value_type get(const Edge_index_accessor& m, const key_type k) { return m[k]; } }; template, OpenMesh::EPropHandleT >::type>::type>::type H; - typedef boost::read_write_property_map_tag category; + typedef boost::lvalue_property_map_tag category; typedef Descriptor key_type; typedef Value value_type; @@ -132,7 +132,6 @@ public: template class OM_edge_weight_pmap - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -149,12 +148,14 @@ public: return sm_.calc_edge_length(e.halfedge()); } + friend inline value_type get(const OM_edge_weight_pmap& m, const key_type& k) { return m[k]; } + private: const OpenMesh& sm_; }; template -class OM_index_pmap : public boost::put_get_helper > +class OM_index_pmap { public: typedef boost::readable_property_map_tag category; @@ -169,6 +170,8 @@ public: { return vd.idx(); } + + friend inline value_type get(const OM_index_pmap& m, const key_type& k) { return m[k]; } }; @@ -176,11 +179,12 @@ template class OM_point_pmap { public: - typedef boost::read_write_property_map_tag category; #if defined(CGAL_USE_OM_POINTS) + typedef boost::lvalue_property_map_tag category; typedef typename OpenMesh::Point value_type; typedef const typename OpenMesh::Point& reference; #else + typedef boost::read_write_property_map_tag category; typedef P value_type; typedef P reference; #endif @@ -198,7 +202,7 @@ public: : sm_(pm.sm_) {} - value_type operator[](key_type v) + reference operator[](key_type v) { #if defined(CGAL_USE_OM_POINTS) return sm_->point(v); diff --git a/BGL/include/CGAL/boost/graph/property_maps.h b/BGL/include/CGAL/boost/graph/property_maps.h index bea0f92725f..c10935e27f2 100644 --- a/BGL/include/CGAL/boost/graph/property_maps.h +++ b/BGL/include/CGAL/boost/graph/property_maps.h @@ -53,7 +53,7 @@ struct Triangle_from_face_descriptor_map{ //get function for property map inline friend - reference + value_type get(const Triangle_from_face_descriptor_map& pmap, key_type f) { @@ -66,7 +66,7 @@ struct Triangle_from_face_descriptor_map{ } inline friend - reference + value_type get(const Triangle_from_face_descriptor_map& pmap, const std::pair& f) { @@ -111,7 +111,7 @@ struct Segment_from_edge_descriptor_map{ //get function for property map inline friend - reference + value_type get(const Segment_from_edge_descriptor_map& pmap, key_type h) { @@ -120,7 +120,7 @@ struct Segment_from_edge_descriptor_map{ } inline friend - reference + value_type get(const Segment_from_edge_descriptor_map& pmap, const std::pair& h) { @@ -154,7 +154,7 @@ struct One_point_from_face_descriptor_map{ typedef typename boost::graph_traits::face_descriptor key_type; typedef typename boost::property_traits< VertexPointMap >::value_type value_type; typedef typename boost::property_traits< VertexPointMap >::reference reference; - typedef boost::lvalue_property_map_tag category; + typedef boost::readable_property_map_tag category; //get function for property map inline friend diff --git a/BGL/include/CGAL/boost/graph/selection.h b/BGL/include/CGAL/boost/graph/selection.h index 668bc4707e0..53d71d30b8e 100644 --- a/BGL/include/CGAL/boost/graph/selection.h +++ b/BGL/include/CGAL/boost/graph/selection.h @@ -102,7 +102,7 @@ struct Regularization_graph typedef vertex_descriptor key_type; typedef std::size_t value_type; typedef std::size_t& reference; - typedef boost::lvalue_property_map_tag category; + typedef boost::read_write_property_map_tag category; Regularization_graph* rg; @@ -132,7 +132,7 @@ struct Regularization_graph : rg (rg) { } - friend reference get (const Vertex_label_probability_map& pmap, key_type fd) + friend value_type get (const Vertex_label_probability_map& pmap, key_type fd) { double value = (1. - pmap.rg->weight) * pmap.rg->area (fd) / pmap.rg->total_area; @@ -167,7 +167,7 @@ struct Regularization_graph Edge_cost_map (const Regularization_graph* rg) : rg (rg) { } - friend reference get (const Edge_cost_map& pmap, key_type ed) + friend value_type get (const Edge_cost_map& pmap, key_type ed) { fg_vertex_descriptor esource = source(ed, pmap.rg->fg); fg_vertex_descriptor etarget = target(ed, pmap.rg->fg); diff --git a/BGL/test/BGL/test_Face_filtered_graph.cpp b/BGL/test/BGL/test_Face_filtered_graph.cpp index 100f08eb278..2da2f3ed205 100644 --- a/BGL/test/BGL/test_Face_filtered_graph.cpp +++ b/BGL/test/BGL/test_Face_filtered_graph.cpp @@ -355,7 +355,7 @@ test_graph_range(const std::vector& graphs) typedef SM::Point Point_3; template -struct Constraint : public boost::put_get_helper > +struct Constraint { typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef boost::readable_property_map_tag category; @@ -363,7 +363,6 @@ struct Constraint : public boost::put_get_helper void test_mesh(Adapter fga) { diff --git a/BGL/test/BGL/test_Properties.cpp b/BGL/test/BGL/test_Properties.cpp index bb541bbc890..d840c837e48 100644 --- a/BGL/test/BGL/test_Properties.cpp +++ b/BGL/test/BGL/test_Properties.cpp @@ -13,12 +13,12 @@ struct Non_mutable_property_map { typedef Key key_type; typedef Value value_type; - typedef value_type reference; + typedef const value_type& reference; typedef boost::readable_property_map_tag category; Non_mutable_property_map(const Container& c) : m_c(c) { } - friend reference get(const Non_mutable_property_map& pmap, key_type k) + friend reference get(const Non_mutable_property_map& pmap, const key_type& k) { return pmap.m_c.at(k); } @@ -42,7 +42,7 @@ struct RW_property_map pmap.m_c[k] = val; } - friend reference get(RW_property_map& pmap, const key_type& k) + friend reference get(const RW_property_map& pmap, const key_type& k) { return pmap.m_c[k]; } diff --git a/Classification/include/CGAL/Classification/Cluster.h b/Classification/include/CGAL/Classification/Cluster.h index a0d0f209602..e532d559ca6 100644 --- a/Classification/include/CGAL/Classification/Cluster.h +++ b/Classification/include/CGAL/Classification/Cluster.h @@ -66,7 +66,6 @@ public: public: using argument_type = std::size_t; using result_type = typename boost::property_traits::reference; - using category = boost::readable_property_map_tag; const ItemRange* m_range; ItemMap m_item_map; diff --git a/Classification/include/CGAL/Classification/Point_set_neighborhood.h b/Classification/include/CGAL/Classification/Point_set_neighborhood.h index 543a664e513..bc1b2b64ef4 100644 --- a/Classification/include/CGAL/Classification/Point_set_neighborhood.h +++ b/Classification/include/CGAL/Classification/Point_set_neighborhood.h @@ -67,10 +67,12 @@ class Point_set_neighborhood using value_type = typename boost::property_traits::value_type; using reference = typename boost::property_traits::reference; using key_type = std::uint32_t; - using category = typename boost::property_traits::category; + using category = boost::readable_property_map_tag; + My_point_property_map () { } My_point_property_map (const PointRange *input, PointMap point_map) : input (input), point_map (point_map) { } + friend reference get (const My_point_property_map& ppmap, key_type i) { return get(ppmap.point_map, *(ppmap.input->begin()+std::size_t(i))); } }; diff --git a/Classification/include/CGAL/Classification/property_maps.h b/Classification/include/CGAL/Classification/property_maps.h index b5ddd61a399..44a0a75f0c0 100644 --- a/Classification/include/CGAL/Classification/property_maps.h +++ b/Classification/include/CGAL/Classification/property_maps.h @@ -67,7 +67,7 @@ public: : m_mesh (mesh), m_vpm (vpm) { } /// \cond SKIP_IN_MANUAL - inline friend reference get (const Face_descriptor_to_center_of_mass_map& map, key_type f) + inline friend value_type get (const Face_descriptor_to_center_of_mass_map& map, key_type f) { std::vector points; @@ -139,7 +139,7 @@ public: : m_mesh (mesh), m_vpm (vpm) { } /// \cond SKIP_IN_MANUAL - inline friend reference get (const Face_descriptor_to_face_descriptor_with_bbox_map& map, key_type f) + inline friend value_type get (const Face_descriptor_to_face_descriptor_with_bbox_map& map, key_type f) { CGAL::Bbox_3 bbox; diff --git a/Hash_map/include/CGAL/Unique_hash_map.h b/Hash_map/include/CGAL/Unique_hash_map.h index 5b6b50d8fb5..1f7d5be6fc0 100644 --- a/Hash_map/include/CGAL/Unique_hash_map.h +++ b/Hash_map/include/CGAL/Unique_hash_map.h @@ -133,21 +133,22 @@ namespace boost { public: typedef KeyType key_type; typedef ValueType value_type; - typedef const value_type& reference; + typedef value_type& reference; typedef lvalue_property_map_tag category; associative_property_map() : m_c(0) { } associative_property_map(C& c) : m_c(&c) { } - value_type& operator[](const key_type& k) const { + + reference operator[](const key_type& k) const { return (*m_c)[k]; } - friend - const value_type& - get(const associative_property_map& uhm, const key_type& key) - { - return uhm[key]; - } + friend + reference + get(const associative_property_map& uhm, const key_type& key) + { + return uhm[key]; + } friend void diff --git a/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf.h b/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf.h index 80dee66895c..700c716ef12 100644 --- a/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf.h +++ b/Jet_fitting_3/examples/Jet_fitting_3/PolyhedralSurf.h @@ -68,12 +68,12 @@ public: template class Facet_PM : - public boost::put_get_helper > + public boost::put_get_helper > { public: //read_write - typedef boost::read_write_property_map_tag category; + typedef boost::lvalue_property_map_tag category; typedef typename TPoly::Facet key_type; typedef typename TPoly::Traits::Vector_3 value_type; typedef typename TPoly::Traits::Vector_3& reference; @@ -121,8 +121,6 @@ class HEdge_PM : public boost::put_get_helper >//double { public: - //read_write or lvalue - //typedef boost::read_write_property_map_tag category; typedef boost::lvalue_property_map_tag category; typedef typename TPoly::Halfedge key_type; typedef typename TPoly::Traits::FT value_type; diff --git a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h index ff980a8c53e..e69acbd8354 100644 --- a/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h +++ b/Linear_cell_complex/include/CGAL/boost/graph/properties_Linear_cell_complex_for_combinatorial_map.h @@ -42,7 +42,6 @@ namespace CGAL { template struct Wrap_squared_lcc - : boost::put_get_helper< double, Wrap_squared_lcc > { typedef typename boost::graph_traits::edge_descriptor Handle; typedef FT value_type; @@ -54,12 +53,19 @@ struct Wrap_squared_lcc {} template - FT operator[](const E& e) const + value_type operator[](const E& e) const { return approximate_sqrt(CGAL::squared_distance (m_lcc.point(e.first_halfedge()), m_lcc.point(e.second_halfedge()))); } + + friend inline + value_type get(const Wrap_squared_lcc& m, const key_type& k) + { + return m[k]; + } + private: const LCC& m_lcc; }; diff --git a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h index 6cea47bc0b0..aaa82040a83 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h @@ -489,8 +489,7 @@ private: * @class PVertex_id * relaxed heap */ - class PVertex_id : - public boost::put_get_helper + class PVertex_id { public: typedef boost::readable_property_map_tag category; @@ -499,6 +498,12 @@ private: typedef PVertex key_type; value_type operator[] (const key_type& pv) const { return pv.id(); } + + friend inline + value_type get(const PVertex_id& m, const key_type& k) + { + return m[k]; + } }; typedef std::less less_PVertex; diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index 604d3e8ab84..81d4177521a 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -1120,11 +1120,12 @@ template struct Get_content_from_polyline_with_context { typedef Get_content_from_polyline_with_context Self; - typedef const PolylineWithContext& key_type; - typedef const typename PolylineWithContext::Bare_polyline& value_type; - typedef value_type reference; + typedef PolylineWithContext key_type; + typedef typename PolylineWithContext::Bare_polyline value_type; + typedef const value_type& reference; typedef boost::readable_property_map_tag category; - friend value_type get(const Self, key_type polyline) { + + friend reference get(const Self&, const key_type& polyline) { return polyline.polyline_content; } }; // end Get_content_from_polyline_with_context @@ -1133,11 +1134,12 @@ template struct Get_patches_id_from_polyline_with_context { typedef Get_patches_id_from_polyline_with_context Self; - typedef const PolylineWithContext& key_type; - typedef const typename PolylineWithContext::Context::Patches_ids& value_type; - typedef value_type reference; + typedef PolylineWithContext key_type; + typedef typename PolylineWithContext::Context::Patches_ids value_type; + typedef const value_type& reference; typedef boost::readable_property_map_tag category; - friend value_type get(const Self, key_type polyline) { + + friend reference get(const Self&, const key_type& polyline) { return polyline.context.adjacent_patches_ids; } }; // end Get_patches_id_from_polyline_with_context diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 0103389b0b6..b671c08ee38 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -1107,7 +1107,7 @@ public: typedef Index key_type; typedef typename Property::value_type value_type; typedef value_type& reference; - typedef boost::lvalue_property_map_tag category; + typedef boost::read_write_property_map_tag category; Point_set* ps; Property* prop; @@ -1118,7 +1118,7 @@ public: Index ind=Index()) : ps(ps), prop(prop), ind(ind) {} - friend void put(const Push_property_map& pm, Index& i, reference t) + friend void put(const Push_property_map& pm, Index& i, const value_type& t) { if(pm.ps->size() <= (pm.ind)) pm.ps->insert(); diff --git a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h index 1c67680a662..282aa89afe1 100644 --- a/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h +++ b/Point_set_processing_3/include/CGAL/Point_set_processing_3/internal/Neighbor_query.h @@ -57,7 +57,7 @@ public: typedef input_iterator key_type; typedef typename boost::property_traits::reference reference; typedef typename boost::property_traits::value_type value_type; - typedef typename boost::property_traits::category category; + typedef typename boost::readable_property_map_tag category; PointMap point_map; diff --git a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h index c223cdad6ba..8ce1e86dbeb 100644 --- a/Point_set_processing_3/include/CGAL/Point_with_normal_3.h +++ b/Point_set_processing_3/include/CGAL/Point_with_normal_3.h @@ -139,12 +139,12 @@ struct Normal_of_point_with_normal_map typedef boost::lvalue_property_map_tag category; /// Access a property map element - value_type& operator[](key_type& pwn) const { return pwn.normal(); } + value_type& operator[](key_type& k) const { return k.normal(); } /// \name Put/get free functions /// @{ - friend reference get(const Self&,const key_type& k) {return k.normal();} - friend void put(const Self&,key_type& k, const value_type& v) {k.normal()=v;} + friend reference get(const Self&, const key_type& k) { return k.normal(); } + friend void put(const Self&, key_type& k, const value_type& v) { k.normal() = v; } /// @};} }; diff --git a/Point_set_processing_3/include/CGAL/estimate_scale.h b/Point_set_processing_3/include/CGAL/estimate_scale.h index b893795e051..4d822891f22 100644 --- a/Point_set_processing_3/include/CGAL/estimate_scale.h +++ b/Point_set_processing_3/include/CGAL/estimate_scale.h @@ -238,23 +238,21 @@ class Quick_multiscale_approximate_knn_distance struct Pmap_to_3d { - PointMap point_map; typedef typename Kernel::Point_3 value_type; - typedef const value_type& reference; + typedef value_type reference; typedef typename Kernel::Point_2 key_type; - typedef boost::lvalue_property_map_tag category; + typedef boost::readable_property_map_tag category; + + PointMap point_map; Pmap_to_3d () { } - Pmap_to_3d (PointMap point_map) - : point_map (point_map) { } + Pmap_to_3d (PointMap point_map) : point_map (point_map) { } - friend inline value_type get (const Pmap_to_3d& pmap, key_type p) + friend inline value_type get (const Pmap_to_3d& pmap, const key_type& p) { - typename boost::property_traits::reference - p2 = get(pmap.point_map, p); + typename boost::property_traits::reference p2 = get(pmap.point_map, p); return value_type (p2.x(), p2.y(), 0.); } - }; struct Sort_by_distance_to_point diff --git a/Point_set_processing_3/include/CGAL/mst_orient_normals.h b/Point_set_processing_3/include/CGAL/mst_orient_normals.h index 280c9271afb..76d9d438ab3 100644 --- a/Point_set_processing_3/include/CGAL/mst_orient_normals.h +++ b/Point_set_processing_3/include/CGAL/mst_orient_normals.h @@ -133,7 +133,7 @@ public: /// Free function to access the map elements. friend inline - reference get(const Default_constrained_map& map, key_type p) + value_type get(const Default_constrained_map& map, const key_type& p) { return (p == *map.m_source_point); } diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/connected_components_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/connected_components_example.cpp index 924d5109ef3..3c4bb3fbb56 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/connected_components_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/connected_components_example.cpp @@ -17,7 +17,7 @@ typedef CGAL::Surface_mesh Mesh; namespace PMP = CGAL::Polygon_mesh_processing; template -struct Constraint : public boost::put_get_helper > +struct Constraint { typedef typename boost::graph_traits::edge_descriptor edge_descriptor; typedef boost::readable_property_map_tag category; @@ -33,7 +33,7 @@ struct Constraint : public boost::put_get_helper > : g_(&g), bound_(bound) {} - bool operator[](edge_descriptor e) const + value_type operator[](edge_descriptor e) const { const G& g = *g_; return compare_(g.point(source(e, g)), @@ -43,6 +43,12 @@ struct Constraint : public boost::put_get_helper > bound_) == CGAL::SMALLER; } + friend inline + value_type get(const Constraint& m, const key_type k) + { + return m[k]; + } + const G* g_; Compare_dihedral_angle_3 compare_; double bound_; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_OM_union.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_OM_union.cpp index fd858fd1341..4c5c529a3d5 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_OM_union.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_OM_union.cpp @@ -22,8 +22,8 @@ struct Exact_vertex_point_map // typedef for the property map typedef boost::property_traits::value_type value_type; typedef boost::property_traits::reference reference; - typedef boost::property_traits::category category; typedef boost::property_traits::key_type key_type; + typedef boost::read_write_property_map_tag category; // exterior references Exact_point_map exact_point_map; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp index 2696bd1b85b..bfb95dcba3a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_consecutive_bool_op.cpp @@ -20,8 +20,8 @@ struct Exact_vertex_point_map // typedef for the property map typedef boost::property_traits::value_type value_type; typedef boost::property_traits::reference reference; - typedef boost::property_traits::category category; typedef boost::property_traits::key_type key_type; + typedef boost::read_write_property_map_tag category; // exterior references Exact_point_map exact_point_map; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h index e3109944ec1..7cc05d49b48 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/detect_features.h @@ -86,7 +86,7 @@ template::value_type> struct PatchIdMapWrapper { - typedef typename boost::property_traits::category category; + typedef typename boost::read_write_property_map_tag category; typedef ValueType value_type; typedef typename boost::property_traits::reference reference; typedef typename boost::property_traits::key_type key_type; @@ -118,7 +118,7 @@ void put(PatchIdMapWrapper& map, Handle_type h, template struct PatchIdMapWrapper > { - typedef typename boost::property_traits::category category; + typedef typename boost::read_write_property_map_tag category; typedef Int value_type; typedef typename boost::property_traits::reference reference; typedef typename boost::property_traits::key_type key_type; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 176dadb3fb1..6f222586fe1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -95,7 +95,7 @@ namespace internal { public: typedef edge_descriptor key_type; typedef bool value_type; - typedef value_type& reference; + typedef value_type reference; typedef boost::read_write_property_map_tag category; Border_constraint_pmap() @@ -169,7 +169,7 @@ namespace internal { public: typedef face_descriptor key_type; typedef Patch_id value_type; - typedef Patch_id& reference; + typedef Patch_id reference; typedef boost::read_write_property_map_tag category; //note pmesh is a non-const ref because properties are added and removed @@ -1126,7 +1126,7 @@ private: { typedef boost::readable_property_map_tag category; typedef Patch_id value_type; - typedef Patch_id& reference; + typedef Patch_id reference; typedef typename Triangle_list::const_iterator key_type; const Self* remesher_ptr_; @@ -1136,7 +1136,7 @@ private: Patch_id_property_map(const Self& remesher) : remesher_ptr_(&remesher) {} - friend Patch_id get(const Patch_id_property_map& m, key_type tr_it) + friend value_type get(const Patch_id_property_map& m, key_type tr_it) { //tr_it is an iterator from triangles_ std::size_t id_in_vec = std::distance( diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 2ef778b07c5..fa51dc44d3a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -1499,7 +1499,7 @@ public: const VertexPointMap& vpm() const { return vpm_; } // get function for property map - inline friend reference get(const Self& pmap, key_type v) { + inline friend value_type get(const Self& pmap, key_type v) { return pmap.converter()(get(pmap.vpm(), v)); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp index 83fa6a1bb53..1ad22a9e053 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_surface_mesh.cpp @@ -20,7 +20,6 @@ typedef CGAL::Surface_mesh Mesh; template struct Constraint - : public boost::put_get_helper > { typedef typename GT::FT FT; @@ -45,6 +44,12 @@ struct Constraint bound) == CGAL::SMALLER; } + friend inline + value_type get(const Constraint& m, const key_type k) + { + return m[k]; + } + const G* g; const GT* gt; FT bound; diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp index a588f252b4c..f6ec53520a5 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/remeshing_test.cpp @@ -122,7 +122,7 @@ struct Constraints_pmap typedef edge_descriptor key_type; typedef bool value_type; - typedef value_type& reference; + typedef value_type reference; typedef boost::read_write_property_map_tag category; public: diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp index bbc980a25dd..98b6eb75f8a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_faces_test.cpp @@ -186,7 +186,7 @@ struct Dual_vpm } friend - Point get(Dual_vpm& map, key_type& f) + value_type get(Dual_vpm& map, key_type f) { std::vector face_points; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp index f4168605e37..6b37d517302 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_normal_estimation_plugin.cpp @@ -82,11 +82,10 @@ struct Vector_to_pmap Vector_to_pmap (std::vector* vec = NULL) : vec (vec) { } friend inline - reference get(const Vector_to_pmap& map, key_type p) + value_type get(const Vector_to_pmap& map, key_type i) { - return (*map.vec)[p]; + return (*map.vec)[i]; } - }; using namespace CGAL::Three; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp index ddcea01a397..9c443f9ae53 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Offset_meshing_plugin.cpp @@ -93,7 +93,7 @@ class Polygon_soup_offset_function { public: typedef Polygon_iterator key_type; typedef EPICK::Point_3 value_type; - typedef value_type reference; + typedef const value_type& reference; typedef boost::readable_property_map_tag category; Polygon_soup_point_property_map() = default; @@ -122,8 +122,8 @@ class Polygon_soup_offset_function { : points_vector_ptr(ptr) {} - friend reference get(Polygon_soup_triangle_property_map map, - key_type polygon_it) + friend value_type get(Polygon_soup_triangle_property_map map, + key_type polygon_it) { auto it = polygon_it->begin(); CGAL_assertion(it != polygon_it->end()); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp index bba6d446aa6..3ca1f0d91f8 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Surface_mesh_approximation_plugin.cpp @@ -37,7 +37,7 @@ class Polyhedron_demo_surface_mesh_approximation_plugin : Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") typedef boost::property_map >::type Face_id_map; - struct Patch_id_pmap : public boost::put_get_helper + struct Patch_id_pmap { public: typedef boost::read_write_property_map_tag category; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 09890b87bda..00b0b6d9041 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -441,10 +441,12 @@ struct ROI_faces_pmap { typedef sm_face_descriptor key_type; typedef std::size_t value_type; - typedef std::size_t& reference; + typedef std::size_t reference; typedef boost::read_write_property_map_tag category; + SMesh* mesh; SMesh::Property_map irmap; + ROI_faces_pmap(std::map*, SMesh* mesh) :mesh(mesh) { @@ -482,7 +484,8 @@ struct ROI_border_pmap ROI_border_pmap(std::set* set_) : m_set_ptr(set_) {} - friend bool get(const ROI_border_pmap& map, const key_type& k) + + friend value_type get(const ROI_border_pmap& map, const key_type& k) { CGAL_assertion(map.m_set_ptr != NULL); return map.m_set_ptr->count(k); @@ -546,7 +549,7 @@ struct Is_constrained_map void clean(){ mesh->remove_property_map(icmap); } - friend bool get(const Is_constrained_map& map, const key_type& k) + friend value_type get(const Is_constrained_map& map, const key_type& k) { return map.icmap[k] != -1; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h index a2f8487b74c..5d96e4fd970 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.h @@ -88,8 +88,9 @@ public: template inline typename Array_based_vertex_point_map::reference -get(Array_based_vertex_point_map map, - typename Array_based_vertex_point_map::key_type key) { +get(const Array_based_vertex_point_map& map, + typename Array_based_vertex_point_map::key_type key) +{ typedef typename boost::property_map::type VertexPointMap; VertexPointMap pmap = get(boost::vertex_point, *map.mesh); return get(pmap, key); @@ -98,9 +99,9 @@ get(Array_based_vertex_point_map map, template inline void -put(Array_based_vertex_point_map map, - typename Array_based_vertex_point_map::key_type key, - typename Array_based_vertex_point_map::value_type val) +put(const Array_based_vertex_point_map& map, + typename Array_based_vertex_point_map::key_type key, + const typename Array_based_vertex_point_map::value_type& val) { typedef typename boost::property_map::type VertexPointMap; VertexPointMap vpmap = get(boost::vertex_point, *map.mesh); diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h index ade03f8d0dc..9b2015c7544 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h @@ -611,7 +611,8 @@ public: Is_constrained_map(SelectionSet* set_) : m_set_ptr(set_) {} - friend bool get(const Is_constrained_map& map, const key_type& k) + + friend value_type get(const Is_constrained_map& map, const key_type& k) { CGAL_assertion(map.m_set_ptr != NULL); return map.m_set_ptr->count(k); @@ -629,7 +630,7 @@ public: { typedef Handle key_type; typedef std::size_t value_type; - typedef value_type& reference; + typedef value_type reference; typedef boost::read_write_property_map_tag category; friend value_type get(Index_map, Handle h) diff --git a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3.h b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3.h index a53bde8e724..163fb490adc 100644 --- a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3.h +++ b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3.h @@ -52,12 +52,12 @@ private: // Special case for edges. template class Polyhedron_edge_index_map_external - : public boost::put_get_helper > + : public boost::put_get_helper > { public: - typedef boost::readable_property_map_tag category; + typedef boost::lvalue_property_map_tag category; typedef std::size_t value_type; - typedef std::size_t reference; + typedef std::size_t& reference; typedef typename boost::graph_traits::edge_descriptor key_type; private: @@ -80,7 +80,6 @@ private: template struct Wrap_squared - : boost::put_get_helper< double, Wrap_squared > { typedef FT value_type; typedef FT reference; @@ -88,9 +87,15 @@ struct Wrap_squared typedef boost::readable_property_map_tag category; template - FT - operator[](const E& e) const { - return approximate_sqrt(CGAL::squared_distance(e.halfedge()->vertex()->point(), e.halfedge()->opposite()->vertex()->point())); + FT operator[](const E& e) const { + return approximate_sqrt(CGAL::squared_distance(e.halfedge()->vertex()->point(), + e.halfedge()->opposite()->vertex()->point())); + } + + friend inline + value_type get(const Wrap_squared& m, const key_type k) + { + return m[k]; } }; diff --git a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h index 63ad423c9c6..1ee30713092 100644 --- a/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h +++ b/Polyhedron/include/CGAL/boost/graph/properties_Polyhedron_3_features.h @@ -198,7 +198,7 @@ struct Polyhedron_incident_patches_pmap { typedef boost::lvalue_property_map_tag category; template - value_type& operator[](Handle_type h) const + reference operator[](Handle_type h) const { return get(*this, h); } diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index 77b150ea9b2..3ad96c2b553 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -81,14 +81,16 @@ public: } } ; - struct Id_map : public boost::put_get_helper + struct Id_map { typedef boost::readable_property_map_tag category; typedef std::size_t value_type; typedef value_type reference; typedef Vertices_in_constraint_iterator key_type; - reference operator[] ( key_type const& x ) const { return x.base()->id ; } + value_type operator[] ( key_type const& x ) const { return x.base()->id ; } + + friend inline value_type get(const Id_map& m, const key_type k) { return m[k]; } } ; typedef CGAL::Modifiable_priority_queue MPQ ; diff --git a/Property_map/include/CGAL/Dynamic_property_map.h b/Property_map/include/CGAL/Dynamic_property_map.h index fb37d46e214..ba3409fb570 100644 --- a/Property_map/include/CGAL/Dynamic_property_map.h +++ b/Property_map/include/CGAL/Dynamic_property_map.h @@ -96,7 +96,7 @@ struct Dynamic { typedef typename PM::key_type key_type; typedef typename PM::value_type value_type; typedef typename PM::reference reference; - typedef typename PM::category category; + typedef boost::read_write_property_map_tag category; typedef Dynamic_property_map_deleter Deleter; @@ -130,9 +130,7 @@ struct Dynamic_with_index typedef typename boost::mpl::if_< boost::is_same, value_type, value_type&>::type reference; - typedef typename boost::mpl::if_< boost::is_same, - boost::read_write_property_map_tag, - boost::lvalue_property_map_tag>::type category; + typedef boost::read_write_property_map_tag category; Dynamic_with_index() : m_values() diff --git a/Property_map/include/CGAL/Index_property_map.h b/Property_map/include/CGAL/Index_property_map.h index 4d170e39e25..a70b94e7905 100644 --- a/Property_map/include/CGAL/Index_property_map.h +++ b/Property_map/include/CGAL/Index_property_map.h @@ -121,7 +121,7 @@ public: /// Free function to access the map elements. friend inline - reference get(const Index_property_map& map, key_type p) + value_type get(const Index_property_map& map, key_type p) { return std::distance(map.m_first, p); } diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 6dfe472310e..52fa89bc070 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -58,7 +58,7 @@ public: inline friend void - put(Static_boolean_property_map, const key_type&, const value_type&) + put(Static_boolean_property_map, const key_type&, value_type) {} }; @@ -169,14 +169,14 @@ struct Dereference_property_map { typedef T* key_type; ///< typedef to 'T*' typedef T value_type; ///< typedef to 'T' - typedef const value_type& reference; ///< typedef to 'T&' + typedef T& reference; ///< typedef to 'T&' typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` /// Access a property map element. /// /// @tparam Iter Type convertible to `key_type`. template - value_type& operator[](Iter it) const { return reference(*it); } + value_type& operator[](Iter it) const { return *it; } }; /// Free function to create a `Dereference_property_map` property map. @@ -197,19 +197,21 @@ make_dereference_property_map(Iter) template struct Identity_property_map { + typedef Identity_property_map Self; + typedef T key_type; ///< typedef to `T` typedef T value_type; ///< typedef to `T` - typedef const T& reference; ///< typedef to `T&` + typedef const T& reference; ///< typedef to `const T&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` + /// Access a property map element. /// @param k a key which is returned as mapped value. value_type& operator[](key_type& k) const { return k; } - typedef Identity_property_map Self; /// \name Put/get free functions /// @{ - friend reference get(const Self&,const key_type& k) {return k;} - friend void put(const Self&,key_type& k, const value_type& v) {k=v;} + friend reference get(const Self&, const key_type& k) { return k; } + friend void put(const Self&, key_type& k, const value_type& v) { k = v; } /// @} }; @@ -225,7 +227,7 @@ struct Identity_property_map_no_lvalue typedef Identity_property_map_no_lvalue Self; - friend reference get(const Self&, const key_type& k) {return k;} + friend value_type get(const Self&, const key_type& k) {return k;} }; /// \endcond @@ -249,20 +251,21 @@ Identity_property_map template struct First_of_pair_property_map { + typedef First_of_pair_property_map Self; + typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::first_type value_type; ///< typedef to `Pair::first_type` - typedef const value_type& reference; ///< typedef to `value_type&` + typedef const value_type& reference; ///< typedef to `const value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag /// Access a property map element. /// @param pair a key whose first item is accessed value_type& operator[](key_type& pair) const { return pair.first; } - typedef First_of_pair_property_map Self; /// \name Put/get free functions /// @{ - friend reference get(const Self&,const key_type& k) {return k.first;} - friend void put(const Self&,key_type& k, const value_type& v) {k.first=v;} + friend reference get(const Self&, const key_type& k) { return k.first; } + friend void put(const Self&, key_type& k, const value_type& v) { k.first = v; } /// @} }; @@ -288,20 +291,21 @@ First_of_pair_property_map template struct Second_of_pair_property_map { + typedef Second_of_pair_property_map Self; + typedef Pair key_type; ///< typedef to `Pair` typedef typename Pair::second_type value_type; ///< typedef to `Pair::second_type` - typedef const value_type& reference; ///< typedef to `value_type&` + typedef const value_type& reference; ///< typedef to `const value_type&` typedef boost::lvalue_property_map_tag category; ///< boost::lvalue_property_map_tag /// Access a property map element. /// @param pair a key whose second item is accessed value_type& operator[](key_type& pair) const { return pair.second; } - typedef Second_of_pair_property_map Self; /// \name Put/get free functions /// @{ - friend reference get(const Self&,const key_type& k) {return k.second;} - friend void put(const Self&,key_type& k, const value_type& v) {k.second=v;} + friend reference get(const Self&, const key_type& k) { return k.second; } + friend void put(const Self&, key_type& k, const value_type& v) { k.second = v; } /// @} }; @@ -326,23 +330,24 @@ Second_of_pair_property_map template struct Nth_of_tuple_property_map { + typedef Nth_of_tuple_property_map Self; + typedef Tuple key_type; ///< typedef to `Tuple` #ifdef DOXYGEN_RUNNING typedef unspecified_type value_type; ///< typedef to the N-th type of the tuple #else typedef typename boost::tuples::element::type value_type; - #endif - typedef const value_type& reference; ///< typedef to `value_type&` +#endif + typedef const value_type& reference; ///< typedef to `const value_type&` typedef boost::lvalue_property_map_tag category; ///< `boost::lvalue_property_map_tag` /// Access a property map element. /// @param tuple a key whose Nth item is accessed value_type& operator[](key_type& tuple) const { return tuple.template get(); } - typedef Nth_of_tuple_property_map Self; /// \name Put/get free functions /// @{ - friend reference get(const Self&, key_type& k) { return k.template get(); } + friend reference get(const Self&, const key_type& k) { return k.template get(); } friend void put(const Self&, key_type& k, const value_type& v) { k.template get() = v; } /// @} }; @@ -360,7 +365,7 @@ struct Nth_of_tuple_property_map > value_type& operator[](key_type& tuple) const { return get(tuple); } - friend reference get(const Self&, key_type& k) { return std::get(k); } + friend reference get(const Self&, const key_type& k) { return std::get(k); } friend void put(const Self&, key_type& k, const value_type& v) { std::get(k) = v; } }; @@ -476,7 +481,7 @@ struct Constant_property_map Constant_property_map(const value_type& default_value = value_type()) : default_value (default_value) { } /// Free function that returns `pm.default_value`. - inline friend value_type + inline friend reference get (const Constant_property_map& pm, const key_type&){ return pm.default_value; } /// Free function that does nothing. diff --git a/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp b/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp index c66c1503702..7cf19b79345 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_with_custom_classes.cpp @@ -87,13 +87,15 @@ namespace Custom { public: using key_type = std::size_t; using value_type = std::size_t; - using category = boost::lvalue_property_map_tag; + using reference = std::size_t; + using category = boost::readable_property_map_tag; Seed_map(const std::map& objects_map) : m_objects_map(objects_map) { } - value_type operator[](const key_type key) const { + value_type operator[](const key_type& key) const + { return m_objects_map.find(key)->second; } diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h index 310a29f9271..3fb4ecea249 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/property_map.h @@ -90,7 +90,7 @@ namespace Shape_detection { typedef value_type reference; typedef boost::read_write_property_map_tag category; - inline friend reference get (const Plane_map&, const key_type& k) + inline friend value_type get (const Plane_map&, const key_type& k) { return value_type(*k); } diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h index 41ac0f567d9..afc172dac4d 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/property_map.h @@ -77,8 +77,9 @@ namespace internal { using Item = typename Iterator::value_type; using value_type = std::size_t; + using reference = std::size_t; using key_type = Item; - using category = boost::lvalue_property_map_tag; + using category = boost::readable_property_map_tag; using Item_map = std::map; @@ -118,7 +119,7 @@ namespace internal { public: using key_type = std::size_t; using value_type = std::size_t; - using category = boost::lvalue_property_map_tag; + using category = boost::readable_property_map_tag; Seed_property_map(const std::vector& seeds) : m_seeds(seeds) diff --git a/Spatial_searching/benchmark/Spatial_searching/nearest_neighbor_searching_inplace_50.cpp b/Spatial_searching/benchmark/Spatial_searching/nearest_neighbor_searching_inplace_50.cpp index 59798b4e13f..531ed1f585b 100644 --- a/Spatial_searching/benchmark/Spatial_searching/nearest_neighbor_searching_inplace_50.cpp +++ b/Spatial_searching/benchmark/Spatial_searching/nearest_neighbor_searching_inplace_50.cpp @@ -24,7 +24,7 @@ public: typedef Point_3 value_type; typedef const value_type& reference; typedef Point key_type; - typedef boost::lvalue_property_map_tag category; + typedef boost::readable_property_map_tag category; My_point_property_map(const std::vector& pts):points(pts){} diff --git a/Spatial_searching/test/Spatial_searching/Point_with_info.h b/Spatial_searching/test/Spatial_searching/Point_with_info.h index 9b49e89a418..a94ab739aca 100644 --- a/Spatial_searching/test/Spatial_searching/Point_with_info.h +++ b/Spatial_searching/test/Spatial_searching/Point_with_info.h @@ -22,12 +22,12 @@ template struct Point_property_map{ typedef Point value_type; typedef const value_type& reference; - typedef const My_point_with_info& key_type; + typedef My_point_with_info key_type; typedef boost::lvalue_property_map_tag category; - reference operator[](key_type k) const {return k.point();} + reference operator[](const key_type& k) const { return k.point(); } - friend reference get(const Point_property_map& ppmap, key_type i) + friend reference get(const Point_property_map& ppmap, const key_type& i) {return ppmap[i];} }; diff --git a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h index f744ae3c9f2..5bff49ebab5 100644 --- a/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h +++ b/Surface_mesh/include/CGAL/boost/graph/properties_Surface_mesh.h @@ -32,7 +32,6 @@ namespace CGAL { template class SM_edge_weight_pmap - : public boost::put_get_helper::type::FT, SM_edge_weight_pmap > { typedef CGAL::Surface_mesh SM; public: @@ -54,6 +53,12 @@ public: pm_[target(e, sm_)])); } + friend inline + value_type get(const SM_edge_weight_pmap& m, const key_type& k) + { + return m[k]; + } + private: typename SM::template Property_map< typename SM::Vertex_index, typename SM::Point > pm_; @@ -62,7 +67,7 @@ private: template -class SM_index_pmap : public boost::put_get_helper > +class SM_index_pmap { public: typedef boost::readable_property_map_tag category; @@ -74,6 +79,12 @@ public: { return vd; } + + friend inline + value_type get(const SM_index_pmap& m, const key_type& k) + { + return m[k]; + } }; } // CGAL diff --git a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h index 06a8151e9b7..f746b515ca6 100644 --- a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h +++ b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h @@ -141,7 +141,9 @@ struct Types_selectors { // on the fly in order the deformation class to be used // with points with minimal requirements template -struct SC_on_the_fly_pmap: public Vertex_point_map{ +struct SC_on_the_fly_pmap + : public Vertex_point_map +{ typedef boost::readable_property_map_tag category; typedef CGAL::Simple_cartesian::Point_3 value_type; typedef value_type reference; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp index 26540107a0b..35d53e1e759 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_OpenMesh.cpp @@ -30,7 +30,7 @@ public: sm_.add_property(constraint); } - inline friend reference get(const Constrained_edge_map& em, key_type e) + inline friend value_type get(const Constrained_edge_map& em, key_type e) { bool b = em.sm_.property(em.constraint,em.sm_.edge_handle(e.idx())); return b; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp index a0a0c94ba5e..6a20f8191ca 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrain_sharp_edges.cpp @@ -25,7 +25,6 @@ namespace SMS = CGAL::Surface_mesh_simplification; // BGL property map which indicates whether an edge is marked as non-removable struct Constrained_edge_map - : public boost::put_get_helper { typedef boost::readable_property_map_tag category; typedef bool value_type; @@ -36,7 +35,9 @@ struct Constrained_edge_map : mConstraints(aConstraints) {} - reference operator[](const key_type& e) const { return is_constrained(e); } + value_type operator[](const key_type& e) const { return is_constrained(e); } + + friend inline value_type get(const Constrained_edge_map& m, const key_type& k) { return m[k]; } bool is_constrained(const key_type& e) const { return mConstraints.is_defined(e); } diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp index 72bb4f20ece..60f3e62c06e 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_polyhedron.cpp @@ -34,7 +34,7 @@ struct Border_is_constrained_edge_map Border_is_constrained_edge_map(const Surface_mesh& sm) : sm_ptr(&sm) {} - friend bool get(Border_is_constrained_edge_map m, const key_type& edge) { + friend value_type get(const Border_is_constrained_edge_map& m, const key_type& edge) { return CGAL::is_border(edge, *m.sm_ptr); } }; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp index 92e8184e96c..7129f23076e 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_constrained_border_surface_mesh.cpp @@ -36,7 +36,7 @@ struct Border_is_constrained_edge_map Border_is_constrained_edge_map(const Surface_mesh& sm) : sm_ptr(&sm) {} - friend bool get(Border_is_constrained_edge_map m, const key_type& edge) { + friend value_type get(const Border_is_constrained_edge_map& m, const key_type& edge) { return CGAL::is_border(edge, *m.sm_ptr); } }; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h index 6e201c00a6e..ebff24a785c 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Common.h @@ -58,7 +58,7 @@ struct No_constrained_edge_map typedef bool value_type; typedef value_type reference; typedef boost::readable_property_map_tag category; - friend bool get(No_constrained_edge_map, key_type) { return false; } + friend value_type get(No_constrained_edge_map, key_type) { return false; } }; } // namespace Surface_mesh_simplification diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h index 64a93d038f9..3476479a1ec 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/internal/Edge_collapse.h @@ -155,7 +155,6 @@ public: }; struct edge_id - : boost::put_get_helper { typedef boost::readable_property_map_tag category; typedef size_type value_type; @@ -167,6 +166,8 @@ public: size_type operator[](const halfedge_descriptor e) const { return m_algorithm->get_edge_id(e); } + friend inline value_type get(const edge_id& m, const key_type& k) { return m[k]; } + const Self* m_algorithm; }; diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h index 105a585b303..b4f1093393d 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_adaptive_remeshing_impl.h @@ -75,13 +75,11 @@ struct No_constraint_pmap public: typedef Primitive key_type; typedef bool value_type; - typedef value_type& reference; + typedef value_type reference; typedef boost::read_write_property_map_tag category; - friend bool get(const No_constraint_pmap&, const key_type&) { - return false; - } - friend void put(No_constraint_pmap&, const key_type&, const bool) {} + friend value_type get(No_constraint_pmap, key_type) { return false; } + friend void put(No_constraint_pmap, key_type, value_type) {} }; template class T2_edge_weight_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -72,13 +70,14 @@ public: value_type operator[](key_type e) const { return approximate_sqrt(tr.segment(e).squared_length()); } + friend inline value_type get(const T2_edge_weight_map& m, key_type k) { return m[k]; } + private: const Tr& tr; }; template class T2_vertex_id_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -93,12 +92,13 @@ public: return v->id(); } + friend inline value_type get(const T2_vertex_id_map& m, key_type k) { return m[k]; } + const Tr& tr; }; template class T2_halfedge_id_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -128,13 +128,14 @@ public: return 2*(f1->edge_id(h.second)) + 1; } + friend inline value_type get(const T2_halfedge_id_map& m, key_type k) { return m[k]; } + private: const Tr& tr; }; template class T2_edge_id_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -157,13 +158,14 @@ public: return f1->edge_id(e.second); } + friend inline value_type get(const T2_edge_id_map& m, key_type k) { return m[k]; } + private: const Tr& tr; }; template class T2_face_id_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -178,6 +180,8 @@ public: return f->id(); } + friend inline value_type get(const T2_face_id_map& m, key_type k) { return m[k]; } + private: const Tr& tr; }; diff --git a/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h b/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h index d5583e000b8..6c3cb021bd6 100644 --- a/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h +++ b/Triangulation_2/include/CGAL/boost/graph/properties_Triangulation_data_structure_2.h @@ -33,13 +33,12 @@ public: typedef typename CGAL::Triangulation_data_structure_2::Vertex_handle key_type; friend reference get(TDS2_vertex_point_map, key_type vh) { return vh->point(); } - friend void put(TDS2_vertex_point_map, key_type vh, reference v) { vh->point() = v; } + friend void put(TDS2_vertex_point_map, key_type vh, const value_type& p) { vh->point() = p; } reference operator[](key_type vh) const { return vh->point(); } }; template class TDS2_edge_weight_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -51,13 +50,14 @@ public: value_type operator[](key_type e) const { return approximate_sqrt(tds.segment(e).squared_length()); } + friend inline value_type get(const TDS2_edge_weight_map& m, const key_type k) { return m[k]; } + private: const CGAL::Triangulation_data_structure_2& tds; }; template class TDS2_vertex_id_map - : public boost::put_get_helper > { public: typedef boost::readable_property_map_tag category; @@ -67,12 +67,13 @@ public: TDS2_vertex_id_map() {} - long operator[](key_type vh) const { return vh->id(); } + value_type operator[](key_type vh) const { return vh->id(); } + + friend inline value_type get(const TDS2_vertex_id_map& m, const key_type k) { return m[k]; } }; template class TDS2_halfedge_id_map - : public boost::put_get_helper > { typedef typename CGAL::Triangulation_data_structure_2 TDS; @@ -98,11 +99,12 @@ public: else return 2*(3 * f2->id() + f2->index(f1)) + 1; } + + friend inline value_type get(const TDS2_halfedge_id_map& m, const key_type k) { return m[k]; } }; template class TDS2_edge_id_map - : public boost::put_get_helper > { typedef typename CGAL::Triangulation_data_structure_2 TDS; @@ -126,11 +128,12 @@ public: else return 3 * f2->id() + f2->index(f1); } + + friend inline value_type get(const TDS2_edge_id_map& m, const key_type k) { return m[k]; } }; template class TDS2_face_id_map - : public boost::put_get_helper > { typedef typename CGAL::Triangulation_data_structure_2 TDS; @@ -143,6 +146,8 @@ public: TDS2_face_id_map() { } value_type operator[](key_type f) const { return f->id(); } + + friend inline value_type get(const TDS2_face_id_map& m, const key_type k) { return m[k]; } }; template From 2331eb7cf478ca9caa335b66aaa056cc654889d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 8 Oct 2021 15:41:54 +0200 Subject: [PATCH 4/9] Fix comment --- BGL/include/CGAL/boost/graph/properties.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties.h b/BGL/include/CGAL/boost/graph/properties.h index 90149829e99..5bbdcd4d9ae 100644 --- a/BGL/include/CGAL/boost/graph/properties.h +++ b/BGL/include/CGAL/boost/graph/properties.h @@ -161,10 +161,11 @@ struct Is_writable_property_map : template struct Is_writable_property_map : CGAL::Tag_true { }; -// 'lvalue_pmap_tag' is annoying, because the property map is allowed to be non-mutable, -// but boost::lvalue_property_map_tag is defined as: +// 'lvalue_property_map_tag' is annoying, because the property map is allowed to be non-mutable, +// but boost::lvalue_property_map_tag is always defined as: // struct lvalue_property_map_tag : public read_write_property_map_tag -// so we can't just check that 'writable_property_map_tag' is a base of the the lvalue tag. +// whereas it should sometimes only be +// struct lvalue_property_map_tag : public readable_property_map_tag. // // This checks if the reference is non-const, which is not completely correct: map[key] returning // a non-const reference doesn't mean that 'put(map, key, val)' exists, which is what a writable From 480c14564a00a4a51d5b8ec9bd752b9aab4455f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 8 Oct 2021 15:42:01 +0200 Subject: [PATCH 5/9] Don't base reference detection on lvalue_property_map_tag --- .../include/CGAL/Search_traits_adapter.h | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Spatial_searching/include/CGAL/Search_traits_adapter.h b/Spatial_searching/include/CGAL/Search_traits_adapter.h index d3c6b49fd60..0d3d30f5de0 100644 --- a/Spatial_searching/include/CGAL/Search_traits_adapter.h +++ b/Spatial_searching/include/CGAL/Search_traits_adapter.h @@ -232,19 +232,16 @@ public: // Select type of iterator + construct class depending on whether // point map is lvalue or not - typedef typename boost::mpl::if_ - ::category >, - typename Base::Cartesian_const_iterator_d, - No_lvalue_iterator>::type + typedef typename boost::mpl::if_< + boost::is_reference::reference>, + typename Base::Cartesian_const_iterator_d, + No_lvalue_iterator>::type Cartesian_const_iterator_d; - typedef typename boost::mpl::if_ - ::category >, - Construct_cartesian_const_iterator_d_lvalue, - Construct_cartesian_const_iterator_d_no_lvalue>::type + + typedef typename boost::mpl::if_< + boost::is_reference::reference>, + Construct_cartesian_const_iterator_d_lvalue, + Construct_cartesian_const_iterator_d_no_lvalue>::type Construct_cartesian_const_iterator_d; struct Construct_iso_box_d: public Base::Construct_iso_box_d{ From 07948c7066e49353f5ba26b540d491a2a26f36b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 11 Oct 2021 12:02:22 +0200 Subject: [PATCH 6/9] Constify the 'operator[]' of non-mutable lvalue pmaps with 'put()'s --- Property_map/include/CGAL/property_map.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 52fa89bc070..86561002f16 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -206,7 +206,7 @@ struct Identity_property_map /// Access a property map element. /// @param k a key which is returned as mapped value. - value_type& operator[](key_type& k) const { return k; } + const value_type& operator[](const key_type& k) const { return k; } /// \name Put/get free functions /// @{ @@ -260,7 +260,7 @@ struct First_of_pair_property_map /// Access a property map element. /// @param pair a key whose first item is accessed - value_type& operator[](key_type& pair) const { return pair.first; } + const value_type& operator[](const key_type& pair) const { return pair.first; } /// \name Put/get free functions /// @{ @@ -300,7 +300,7 @@ struct Second_of_pair_property_map /// Access a property map element. /// @param pair a key whose second item is accessed - value_type& operator[](key_type& pair) const { return pair.second; } + const value_type& operator[](const key_type& pair) const { return pair.second; } /// \name Put/get free functions /// @{ @@ -343,7 +343,7 @@ struct Nth_of_tuple_property_map /// Access a property map element. /// @param tuple a key whose Nth item is accessed - value_type& operator[](key_type& tuple) const { return tuple.template get(); } + const value_type& operator[](const key_type& tuple) const { return tuple.template get(); } /// \name Put/get free functions /// @{ @@ -363,7 +363,7 @@ struct Nth_of_tuple_property_map > typedef const value_type& reference; typedef boost::lvalue_property_map_tag category; - value_type& operator[](key_type& tuple) const { return get(tuple); } + const value_type& operator[](const key_type& tuple) const { return get(tuple); } friend reference get(const Self&, const key_type& k) { return std::get(k); } friend void put(const Self&, key_type& k, const value_type& v) { std::get(k) = v; } From b7e688cc948a01db24ab8afc3932de4b6038bc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Oct 2021 09:05:42 +0200 Subject: [PATCH 7/9] remove TWS --- .../include/CGAL/Polyline_simplification_2/simplify.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h index fccc09b6291..ad9e75cf178 100644 --- a/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h +++ b/Polyline_simplification_2/include/CGAL/Polyline_simplification_2/simplify.h @@ -105,7 +105,7 @@ public: { return x->ID; } - + friend inline value_type get(const Id_map& m, const key_type k) { return m[k]; } } ; From 79fc4933922edfb1eb6fe9dab24d3d887046cbce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 19 Oct 2021 16:07:44 +0200 Subject: [PATCH 8/9] Add a default constructor to Property_map_binder Needed for example if you need to default construct AABB traits with external pmaps that are Property_map_binders --- Property_map/include/CGAL/property_map.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 90d8c6eba92..d693723f5e6 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -99,7 +99,8 @@ make_OR_property_map(const PM1& pm1, const PM2& pm2) // A property map that uses the result of a property map as key. template -struct Property_map_binder{ +struct Property_map_binder +{ typedef typename boost::property_traits::key_type key_type; typedef typename boost::property_traits::value_type value_type; typedef typename boost::property_traits::reference reference; @@ -108,6 +109,7 @@ struct Property_map_binder{ KeyMap key_map; ValueMap value_map; + Property_map_binder() { } Property_map_binder(const KeyMap& key_map, const ValueMap& value_map) : key_map(key_map) , value_map(value_map) From d6a950078a8ab96aa46fd8ee8097add6788d364e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 20 Oct 2021 15:07:34 +0200 Subject: [PATCH 9/9] Further enhancements to the pmap binder's constructors --- Property_map/include/CGAL/property_map.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index d693723f5e6..489305738c7 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -19,8 +19,6 @@ #include #include -#include // defines std::pair - #include #include #include @@ -28,6 +26,13 @@ #include #include +#include +#include +#include +#include +#include +#include + namespace CGAL { /// \cond SKIP_DOXYGEN @@ -109,11 +114,16 @@ struct Property_map_binder KeyMap key_map; ValueMap value_map; - Property_map_binder() { } - Property_map_binder(const KeyMap& key_map, const ValueMap& value_map) - : key_map(key_map) - , value_map(value_map) - {} + Property_map_binder(const KeyMap& key_map = KeyMap(), + const ValueMap& value_map = ValueMap()) + : key_map(key_map), value_map(value_map) + { } + + template + Property_map_binder(const VM& value_map, + typename std::enable_if::value>::type* = nullptr) + : value_map(value_map) + { } friend reference get(const Property_map_binder& map, key_type k)