diff --git a/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h b/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h index 9d44f2987c2..aa4e388f9b4 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_Surface_mesh.h @@ -26,21 +26,11 @@ #include #include -// ATTN: is included at the end of this -// file, because we need to fix some calls in that file instead of -// using ADL on broken compilers, hence those calls need to declared -// before that. +#include #include -namespace CGAL { -template -class In_edge_iterator; -template -class Out_edge_iterator; - -} namespace boost { @@ -542,6 +532,8 @@ bool is_valid(CGAL::Surface_mesh

& sm, bool verbose = false) } // namespace CGAL -#include + + + #endif // CGAL_BOOST_GRAPH_TRAITS_SURFACE_MESH_H diff --git a/BGL/include/CGAL/boost/graph/iterator.h b/BGL/include/CGAL/boost/graph/iterator.h index e794fcc0a66..61eacb193aa 100644 --- a/BGL/include/CGAL/boost/graph/iterator.h +++ b/BGL/include/CGAL/boost/graph/iterator.h @@ -20,6 +20,8 @@ #ifndef CGAL_BGL_ITERATORS_H #define CGAL_BGL_ITERATORS_H +#include + #include #include @@ -179,28 +181,6 @@ struct Opposite_face { return face(opposite(h,*g),*g); } }; - -// With gcc 4.4 and std=c++0x do not use ADL to find next/prev. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40497 -template -A adl_next(A a, const Mesh& m) { -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4 - return CGAL::next(a, m); -#else - return next(a, m); -#endif -} - -template -A adl_prev(A a, const Mesh& m) { -#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4 - return CGAL::prev(a, m); -#else - return prev(a, m); -#endif -} - - } // namespace internal /// \endcond @@ -278,7 +258,7 @@ public: } Self& operator++() { - pos = internal::adl_next(opposite(pos,*g),*g); + pos = next(opposite(pos,*g),*g); if ( pos == anchor) ++winding; return *this; @@ -291,7 +271,7 @@ public: Self& operator--() { if ( pos == anchor) --winding; - pos = opposite(internal::adl_prev(pos,*g),*g); + pos = opposite(prev(pos,*g),*g); return *this; } Self operator--(int) { @@ -378,7 +358,7 @@ public: } Self& operator++() { - pos = opposite(internal::adl_next(pos,*g),*g); + pos = opposite(next(pos,*g),*g); if ( pos == anchor) ++winding; return *this; @@ -391,7 +371,7 @@ public: Self& operator--() { if ( pos == anchor) --winding; - pos = internal::adl_prev(opposite(pos,*g),*g); + pos = prev(opposite(pos,*g),*g); return *this; } Self operator--(int) { @@ -484,7 +464,7 @@ public: if ( pos == anchor) --winding; - pos = internal::adl_prev(pos,*g); + pos = prev(pos,*g); return *this; } @@ -704,7 +684,7 @@ public: Self& operator++() { CGAL_assertion(g != NULL); - pos = opposite(internal::adl_next(pos,*g),*g); + pos = opposite(next(pos,*g),*g); return *this; } @@ -719,7 +699,7 @@ public: Self& operator--() { CGAL_assertion(g != NULL); - pos = internal::adl_prev(opposite(pos,*g),*g); + pos = prev(opposite(pos,*g),*g); return *this; } @@ -799,7 +779,7 @@ public: Self& operator++() { CGAL_assertion(g != NULL); - pos = internal::adl_next(pos,*g); + pos = next(pos,*g); return *this; } @@ -814,7 +794,7 @@ public: Self& operator--() { CGAL_assertion(g != NULL); - pos = internal::adl_prev(pos,*g); + pos = prev(pos,*g); return *this; } diff --git a/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h b/BGL/include/CGAL/boost/graph/properties_Surface_mesh.h index fb604184145..86a0d227e3f 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 47f89324877..ffd91be52d8 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 -#include +#include "CGAL/Surface_mesh/Surface_mesh_fwd.h" +#include "CGAL/Surface_mesh/Surface_mesh.h" #ifdef DOXYGEN_RUNNING namespace CGAL { diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index 62cfd4103f9..ae9452eec8b 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -31,6 +31,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -2085,40 +2089,16 @@ public: private: //--------------------------------------------------- property handling - // 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 {}; + /// @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; - template - 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::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::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::Face_index, dummy> { - CGAL::Surface_mesh

* m_; - Property_selector(CGAL::Surface_mesh

* m) : m_(m) {} - Property_container::Face_index>& - operator()() { return m_->fprops_; } - }; + map_type pmap_; + /// @endcond public: @@ -2150,9 +2130,9 @@ private: //--------------------------------------------------- property handling template - std::pair, bool> + std::pair, bool> add_property_map(const std::string& name, const T t=T()) { - return Property_selector(this)().template add(name, t); + return (this->*boost::fusion::at_key(pmap_)).template add(name, t); } @@ -2163,7 +2143,7 @@ private: //--------------------------------------------------- property handling template std::pair,bool> property_map(const std::string& name) const { - return Property_selector(const_cast(this))().template get(name); + return (this->*boost::fusion::at_key(pmap_)).template get(name); } @@ -2172,7 +2152,7 @@ private: //--------------------------------------------------- property handling template void remove_property_map(Property_map& p) { - (Property_selector(this)()).remove(p); + (this->*boost::fusion::at_key(pmap_)).remove(p); } /// @cond CGAL_DOCUMENT_INTERNALS @@ -2185,16 +2165,16 @@ private: //--------------------------------------------------- property handling template const std::type_info& property_type(const std::string& name) { - return Property_selector(this)().get_type(name); + return (this->*boost::fusion::at_key(pmap_)).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 Property_selector(this)().properties(); + return (this->*boost::fusion::at_key(pmap_)).properties(); } /// returns the property for the string "v:point". @@ -2385,6 +2365,10 @@ 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() @@ -2410,6 +2394,8 @@ operator=(const Surface_mesh

& rhs) { if (this != &rhs) { + pmap_ = rhs.pmap_; + // deep copy of property containers vprops_ = rhs.vprops_; hprops_ = rhs.hprops_; 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 6bce7b0024b..19707b71e89 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh_fwd.h @@ -18,6 +18,8 @@ #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.