mirror of https://github.com/CGAL/cgal
On GCC 4.4 with C++0x enabled, ADL + next is unreliable
This is a combination of two bugs: the call to next should pick up CGAL::next to begin with and even if it didn't iterator_traits should arguably be SFINAE friendly. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40497 We fix this by fully qualifying the call on the affected compiler. To make this work we have to partially break the dependency between CGAL/boost/graph/iterator.h and CGAL/boost/graph/graph_traits_Surface_mesh.h
This commit is contained in:
parent
0cda240dd1
commit
224d63be58
|
|
@ -26,11 +26,21 @@
|
|||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
#include <CGAL/boost/graph/properties_Surface_mesh.h>
|
||||
#include <CGAL/boost/graph/iterator.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/Surface_mesh.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template<typename Graph>
|
||||
class In_edge_iterator;
|
||||
template<typename Graph>
|
||||
class Out_edge_iterator;
|
||||
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
|
@ -532,8 +542,6 @@ 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
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
#ifndef CGAL_BGL_ITERATORS_H
|
||||
#define CGAL_BGL_ITERATORS_H
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
|
@ -181,6 +179,28 @@ 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
|
||||
|
||||
|
|
@ -258,7 +278,7 @@ public:
|
|||
}
|
||||
|
||||
Self& operator++() {
|
||||
pos = next(opposite(pos,*g),*g);
|
||||
pos = internal::adl_next(opposite(pos,*g),*g);
|
||||
if ( pos == anchor)
|
||||
++winding;
|
||||
return *this;
|
||||
|
|
@ -271,7 +291,7 @@ public:
|
|||
Self& operator--() {
|
||||
if ( pos == anchor)
|
||||
--winding;
|
||||
pos = opposite(prev(pos,*g),*g);
|
||||
pos = opposite(internal::adl_prev(pos,*g),*g);
|
||||
return *this;
|
||||
}
|
||||
Self operator--(int) {
|
||||
|
|
@ -358,7 +378,7 @@ public:
|
|||
}
|
||||
|
||||
Self& operator++() {
|
||||
pos = opposite(next(pos,*g),*g);
|
||||
pos = opposite(internal::adl_next(pos,*g),*g);
|
||||
if ( pos == anchor)
|
||||
++winding;
|
||||
return *this;
|
||||
|
|
@ -371,7 +391,7 @@ public:
|
|||
Self& operator--() {
|
||||
if ( pos == anchor)
|
||||
--winding;
|
||||
pos = prev(opposite(pos,*g),*g);
|
||||
pos = internal::adl_prev(opposite(pos,*g),*g);
|
||||
return *this;
|
||||
}
|
||||
Self operator--(int) {
|
||||
|
|
@ -464,7 +484,7 @@ public:
|
|||
if ( pos == anchor)
|
||||
--winding;
|
||||
|
||||
pos = prev(pos,*g);
|
||||
pos = internal::adl_prev(pos,*g);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -684,7 +704,7 @@ public:
|
|||
Self& operator++()
|
||||
{
|
||||
CGAL_assertion(g != NULL);
|
||||
pos = opposite(next(pos,*g),*g);
|
||||
pos = opposite(internal::adl_next(pos,*g),*g);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +719,7 @@ public:
|
|||
Self& operator--()
|
||||
{
|
||||
CGAL_assertion(g != NULL);
|
||||
pos = prev(opposite(pos,*g),*g);
|
||||
pos = internal::adl_prev(opposite(pos,*g),*g);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -779,7 +799,7 @@ public:
|
|||
Self& operator++()
|
||||
{
|
||||
CGAL_assertion(g != NULL);
|
||||
pos = next(pos,*g);
|
||||
pos = internal::adl_next(pos,*g);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -794,7 +814,7 @@ public:
|
|||
Self& operator--()
|
||||
{
|
||||
CGAL_assertion(g != NULL);
|
||||
pos = prev(pos,*g);
|
||||
pos = internal::adl_prev(pos,*g);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue