correct enable_if

This commit is contained in:
Sébastien Loriot 2012-05-10 08:19:38 +00:00
parent 31d6ebe9bf
commit 388d53e0a3
1 changed files with 15 additions and 6 deletions

View File

@ -37,7 +37,18 @@
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
namespace CGAL { namespace CGAL {
namespace internal{
template <class T,bool is_iterator_=is_iterator<T>::value>
struct Extract_value_type_of_iterator{
struct value_type{};
};
template <class T>
struct Extract_value_type_of_iterator<T,true>{
typedef typename std::iterator_traits<T>::value_type value_type;
};
}
template < class HalfedgeGraph, template < class HalfedgeGraph,
class cache_primitive=Tag_false, class cache_primitive=Tag_false,
@ -59,15 +70,13 @@ class AABB_HalfedgeGraph_segment_primitive : public AABB_primitive< Id_,
public: public:
// constructors // constructors
AABB_HalfedgeGraph_segment_primitive(Id_ it) : Base(it){} AABB_HalfedgeGraph_segment_primitive(Id_ it) : Base(it){}
//the enable_if is required here so that the first overload is chosen when an Edge_iterator is provided
template <class Iterator> template <class Iterator>
AABB_HalfedgeGraph_segment_primitive(Iterator it, AABB_HalfedgeGraph_segment_primitive(Iterator it,
typename boost::enable_if< typename boost::enable_if<
boost::mpl::and_< boost::is_convertible<
boost::integral_constant<bool, is_iterator<Iterator>::value >, typename internal::Extract_value_type_of_iterator<Iterator>::value_type,
boost::is_convertible< std::pair<HalfedgeGraph*,Id_>
typename std::iterator_traits<Iterator>::value_type,
std::pair<HalfedgeGraph*,Id_>
>
> >
>::type* = NULL ) >::type* = NULL )
: Base( it->second, : Base( it->second,