From 3533e77dfeacc054a17336a0c4dbd925abfb9643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 30 Jul 2015 14:16:12 +0200 Subject: [PATCH 1/4] Remove Boost.Fusion dependency Boost.Fusion in 1.57 fails to compile on gcc 4.4 + std=c++0x (see https://svn.boost.org/trac/boost/ticket/10190). Since we want support for that platform, the fusion map is replaced by a specialized class template Property_selector. --- .../include/CGAL/Surface_mesh/Surface_mesh.h | 66 +++++++++++-------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index e93eaa96bd8..f2c743b43e5 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -32,10 +32,6 @@ #include #include #include -#include -#include -#include -#include #include #include @@ -2249,16 +2245,40 @@ public: private: //--------------------------------------------------- property handling - /// @cond BROKEN_DOC - typedef boost::fusion::map< - boost::fusion::pair< typename Surface_mesh::Vertex_index, Property_container (Surface_mesh::*)>, - boost::fusion::pair< typename Surface_mesh::Halfedge_index, Property_container (Surface_mesh::*)>, - boost::fusion::pair< typename Surface_mesh::Edge_index, Property_container (Surface_mesh::*)>, - boost::fusion::pair< typename Surface_mesh::Face_index, Property_container (Surface_mesh::*)> > - map_type; + // Property_selector maps an index type to a property_container, the + // dummy is necessary to make it a partial specialization (full + // specializations are only allowed at namespace scope). + template + struct Property_selector; - map_type pmap_; - /// @endcond + template + struct Property_selector { + Surface_mesh* m_; + Property_selector(Surface_mesh* m) : m_(m) {} + Property_container& + operator()() { return m_->vprops_; } + }; + template + struct Property_selector { + Surface_mesh* m_; + Property_selector(Surface_mesh* m) : m_(m) {} + Property_container& + operator()() { return m_->hprops_; } + }; + template + struct Property_selector { + Surface_mesh* m_; + Property_selector(Surface_mesh* m) : m_(m) {} + Property_container& + operator()() { return m_->eprops_; } + }; + template + struct Property_selector { + Surface_mesh* m_; + Property_selector(Surface_mesh* m) : m_(m) {} + Property_container& + operator()() { return m_->fprops_; } + }; public: @@ -2290,9 +2310,9 @@ private: //--------------------------------------------------- property handling template - std::pair, bool> + std::pair, bool> add_property_map(const std::string& name, const T t=T()) { - return (this->*boost::fusion::at_key(pmap_)).template add(name, t); + return Property_selector(this)().template add(name, t); } @@ -2303,7 +2323,7 @@ private: //--------------------------------------------------- property handling template std::pair,bool> property_map(const std::string& name) const { - return (this->*boost::fusion::at_key(pmap_)).template get(name); + return Property_selector(const_cast(this))().template get(name); } @@ -2312,7 +2332,7 @@ private: //--------------------------------------------------- property handling template void remove_property_map(Property_map& p) { - (this->*boost::fusion::at_key(pmap_)).remove(p); + (Property_selector(this)()).remove(p); } /// @cond CGAL_DOCUMENT_INTERNALS @@ -2325,16 +2345,16 @@ private: //--------------------------------------------------- property handling template const std::type_info& property_type(const std::string& name) { - return (this->*boost::fusion::at_key(pmap_)).get_type(name); + return Property_selector(this)().get_type(name); } - /// @endcond + /// @endcond /// returns a vector with all strings that describe properties with the key type `I`. /// @tparam I The key type of the properties. template std::vector properties() const { - return (this->*boost::fusion::at_key(pmap_)).properties(); + return Property_selector(this)().properties(); } /// returns the property for the string "v:point". @@ -2526,10 +2546,6 @@ private: //------------------------------------------------------- private data template Surface_mesh

:: Surface_mesh() - : pmap_(boost::fusion::make_pair< typename Surface_mesh::Vertex_index >(&Surface_mesh::vprops_) - , boost::fusion::make_pair< typename Surface_mesh::Halfedge_index >(&Surface_mesh::hprops_) - , boost::fusion::make_pair< typename Surface_mesh::Edge_index >(&Surface_mesh::eprops_) - , boost::fusion::make_pair< typename Surface_mesh::Face_index >(&Surface_mesh::fprops_)) { // allocate standard properties // same list is used in operator=() and assign() @@ -2555,8 +2571,6 @@ operator=(const Surface_mesh

& rhs) { if (this != &rhs) { - pmap_ = rhs.pmap_; - // deep copy of property containers vprops_ = rhs.vprops_; hprops_ = rhs.hprops_; From 0b5e6829859473d637139a5fb15e0fe6c74a26a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 30 Jul 2015 14:16:26 +0200 Subject: [PATCH 2/4] Clean up some includes --- BGL/include/CGAL/boost/graph/properties_Surface_mesh.h | 2 +- Surface_mesh/include/CGAL/Surface_mesh.h | 4 ++-- Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h b/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h index 729ddb1f0e8..08306f745ef 100644 --- a/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h +++ b/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h @@ -22,7 +22,7 @@ #define CGAL_PROPERTIES_SURFACE_MESH_H #include -#include +#include #include #include diff --git a/Surface_mesh/include/CGAL/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh.h index ffd91be52d8..47f89324877 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh.h @@ -19,8 +19,8 @@ #ifndef CGAL_TOP_LEVEL_SURFACE_MESH_H #define CGAL_TOP_LEVEL_SURFACE_MESH_H -#include "CGAL/Surface_mesh/Surface_mesh_fwd.h" -#include "CGAL/Surface_mesh/Surface_mesh.h" +#include +#include #ifdef DOXYGEN_RUNNING namespace CGAL { diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h index 19707b71e89..6bce7b0024b 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h @@ -18,8 +18,6 @@ #ifndef CGAL_SURFACE_MESH_FWD_H #define CGAL_SURFACE_MESH_FWD_H -#include - /// \file Surface_mesh_fwd.h /// Forward declarations of the Surface_mesh package. From 6d1d3f04ba29b2cb0c5bd347f6daafeb6b743ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 30 Jul 2015 14:16:46 +0200 Subject: [PATCH 3/4] Fix compilation errors for VS Note that removing the "template" keyword may break compilation for other compilers --- .../include/CGAL/Surface_mesh/Surface_mesh.h | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index f2c743b43e5..e60a3f53ba5 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2249,34 +2249,34 @@ private: //--------------------------------------------------- property handling // dummy is necessary to make it a partial specialization (full // specializations are only allowed at namespace scope). template - struct Property_selector; + struct Property_selector {}; template - struct Property_selector { - Surface_mesh* m_; - Property_selector(Surface_mesh* m) : m_(m) {} - Property_container& + struct Property_selector::Vertex_index, dummy> { + CGAL::Surface_mesh

* m_; + Property_selector(CGAL::Surface_mesh

* m) : m_(m) {} + Property_container::Vertex_index>& operator()() { return m_->vprops_; } }; template - struct Property_selector { - Surface_mesh* m_; - Property_selector(Surface_mesh* m) : m_(m) {} - Property_container& + struct Property_selector::Halfedge_index, dummy> { + CGAL::Surface_mesh

* m_; + Property_selector(CGAL::Surface_mesh

* m) : m_(m) {} + Property_container::Halfedge_index>& operator()() { return m_->hprops_; } }; template - struct Property_selector { - Surface_mesh* m_; - Property_selector(Surface_mesh* m) : m_(m) {} - Property_container& + struct Property_selector::Edge_index, dummy> { + CGAL::Surface_mesh

* m_; + Property_selector(CGAL::Surface_mesh

* m) : m_(m) {} + Property_container::Edge_index>& operator()() { return m_->eprops_; } }; template - struct Property_selector { - Surface_mesh* m_; - Property_selector(Surface_mesh* m) : m_(m) {} - Property_container& + struct Property_selector::Face_index, dummy> { + CGAL::Surface_mesh

* m_; + Property_selector(CGAL::Surface_mesh

* m) : m_(m) {} + Property_container::Face_index>& operator()() { return m_->fprops_; } }; From bda64df54446a3a9908d35070f93efd217892783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 30 Jul 2015 14:16:59 +0200 Subject: [PATCH 4/4] Remove unnecessary includes --- BGL/test/BGL/test_Euler_operations.cpp | 2 +- BGL/test/BGL/test_Prefix.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/BGL/test/BGL/test_Euler_operations.cpp b/BGL/test/BGL/test_Euler_operations.cpp index 1131fa70bbb..0a6abcc2fe1 100644 --- a/BGL/test/BGL/test_Euler_operations.cpp +++ b/BGL/test/BGL/test_Euler_operations.cpp @@ -1,8 +1,8 @@ #include "test_Prefix.h" +#include #include - template void join_face_test() diff --git a/BGL/test/BGL/test_Prefix.h b/BGL/test/BGL/test_Prefix.h index 6ed5195d35b..c9533a6618b 100644 --- a/BGL/test/BGL/test_Prefix.h +++ b/BGL/test/BGL/test_Prefix.h @@ -7,8 +7,6 @@ #include #include -#include -#include #include