Revert "Merge pull request #143 from bo0ts/Surface_mesh-gcc44_fixes-pmoeller"

This reverts commit 8cffc8be58, reversing
changes made to c1a0afd97a.

Philipp (@bo0ts) will open a new pull-request so solve the issue.
This commit is contained in:
Laurent Rineau 2015-07-14 18:29:43 +02:00
parent abb42e214b
commit 2a9b9330c3
6 changed files with 46 additions and 86 deletions

View File

@ -26,21 +26,11 @@
#include <boost/iterator/transform_iterator.hpp>
#include <CGAL/boost/graph/properties_Surface_mesh.h>
// ATTN: <CGAL/boost/graph/iterator.h> 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 <CGAL/boost/graph/iterator.h>
#include <CGAL/Surface_mesh.h>
namespace CGAL {
template<typename Graph>
class In_edge_iterator;
template<typename Graph>
class Out_edge_iterator;
}
namespace boost {
@ -542,6 +532,8 @@ bool is_valid(CGAL::Surface_mesh<P>& sm, bool verbose = false)
} // namespace CGAL
#include <CGAL/boost/graph/iterator.h>
#endif // CGAL_BOOST_GRAPH_TRAITS_SURFACE_MESH_H

View File

@ -20,6 +20,8 @@
#ifndef CGAL_BGL_ITERATORS_H
#define CGAL_BGL_ITERATORS_H
#include <stdexcept>
#include <boost/graph/graph_traits.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@ -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<typename A, typename Mesh>
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<typename A, typename Mesh>
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;
}

View File

@ -22,7 +22,7 @@
#define CGAL_PROPERTIES_SURFACE_MESH_H
#include <CGAL/assertions.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Surface_mesh/Surface_mesh.h>
#include <CGAL/Kernel_traits.h>
#include <CGAL/squared_distance_3.h>

View File

@ -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 "CGAL/Surface_mesh/Surface_mesh_fwd.h"
#include "CGAL/Surface_mesh/Surface_mesh.h"
#ifdef DOXYGEN_RUNNING
namespace CGAL {

View File

@ -31,6 +31,10 @@
#include <boost/cstdint.hpp>
#include <boost/array.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/fusion/container/map.hpp>
#include <boost/fusion/include/map.hpp>
#include <boost/fusion/include/at_key.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/foreach.hpp>
#include <boost/property_map/property_map.hpp>
@ -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<typename, bool = true>
struct Property_selector {};
/// @cond BROKEN_DOC
typedef boost::fusion::map<
boost::fusion::pair< typename Surface_mesh::Vertex_index, Property_container<Vertex_index> (Surface_mesh::*)>,
boost::fusion::pair< typename Surface_mesh::Halfedge_index, Property_container<Halfedge_index> (Surface_mesh::*)>,
boost::fusion::pair< typename Surface_mesh::Edge_index, Property_container<Edge_index> (Surface_mesh::*)>,
boost::fusion::pair< typename Surface_mesh::Face_index, Property_container<Face_index> (Surface_mesh::*)> >
map_type;
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Vertex_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Vertex_index>&
operator()() { return m_->vprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Halfedge_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Halfedge_index>&
operator()() { return m_->hprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Edge_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Edge_index>&
operator()() { return m_->eprops_; }
};
template<bool dummy>
struct Property_selector<typename CGAL::Surface_mesh<P>::Face_index, dummy> {
CGAL::Surface_mesh<P>* m_;
Property_selector(CGAL::Surface_mesh<P>* m) : m_(m) {}
Property_container<typename CGAL::Surface_mesh<P>::Face_index>&
operator()() { return m_->fprops_; }
};
map_type pmap_;
/// @endcond
public:
@ -2150,9 +2130,9 @@ private: //--------------------------------------------------- property handling
template<class I, class T>
std::pair<Property_map<I, T>, bool>
std::pair<Property_map<I, T>, bool>
add_property_map(const std::string& name, const T t=T()) {
return Property_selector<I>(this)().template add<T>(name, t);
return (this->*boost::fusion::at_key<I>(pmap_)).template add<T>(name, t);
}
@ -2163,7 +2143,7 @@ private: //--------------------------------------------------- property handling
template <class I, class T>
std::pair<Property_map<I, T>,bool> property_map(const std::string& name) const
{
return Property_selector<I>(const_cast<Surface_mesh*>(this))().template get<T>(name);
return (this->*boost::fusion::at_key<I>(pmap_)).template get<T>(name);
}
@ -2172,7 +2152,7 @@ private: //--------------------------------------------------- property handling
template<class I, class T>
void remove_property_map(Property_map<I, T>& p)
{
(Property_selector<I>(this)()).remove(p);
(this->*boost::fusion::at_key<I>(pmap_)).remove(p);
}
/// @cond CGAL_DOCUMENT_INTERNALS
@ -2185,16 +2165,16 @@ private: //--------------------------------------------------- property handling
template<class I>
const std::type_info& property_type(const std::string& name)
{
return Property_selector<I>(this)().get_type(name);
return (this->*boost::fusion::at_key<I>(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<class I>
std::vector<std::string> properties() const
{
return Property_selector<I>(this)().properties();
return (this->*boost::fusion::at_key<I>(pmap_)).properties();
}
/// returns the property for the string "v:point".
@ -2385,6 +2365,10 @@ private: //------------------------------------------------------- private data
template <typename P>
Surface_mesh<P>::
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<P>& rhs)
{
if (this != &rhs)
{
pmap_ = rhs.pmap_;
// deep copy of property containers
vprops_ = rhs.vprops_;
hprops_ = rhs.hprops_;

View File

@ -18,6 +18,8 @@
#ifndef CGAL_SURFACE_MESH_FWD_H
#define CGAL_SURFACE_MESH_FWD_H
#include <string>
/// \file Surface_mesh_fwd.h
/// Forward declarations of the Surface_mesh package.