diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h index 2d892f36bb0..025812615b7 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBTraits.h @@ -121,7 +121,7 @@ typedef Hidden_type Do_intersect; /*! A functor object to compute the intersection of a query and a primitive. Provides the operator: -`boost::optional::type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. +`boost::optional::%Type > operator()(const Query & q, const Primitive& primitive);` which returns the intersection as a pair composed of an object and a primitive id, iff the query intersects the primitive. \cgalHeading{Note on Backward Compatibility} Before the release 4.3 of \cgal, the return type of this function used to be `boost::optional`. */ diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 02fd3e968a0..349607ceee6 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -36,6 +36,15 @@ namespace CGAL { +namespace internal{ namespace AABB_tree { + template + struct Remove_optional { typedef T type; }; + + template + struct Remove_optional< ::boost::optional > { typedef T type; }; + +} } //end of namespace internal::AABB_tree + /// \addtogroup PkgAABB_tree /// @{ @@ -68,11 +77,18 @@ public: typedef typename std::pair Point_and_primitive_id; - ///\todo update this to use the return type of `GeomTraits::Intersection` together with an helper to remove optional + /// `Intersection_and_primitive_id::%Type::first_type` is found according to + /// the result type of `GeomTraits::Intersect_3::operator()`, + /// (that is cpp11::result_of::type). If it is + /// `boost::optional` then it is `T`, and the result type otherwise. template struct Intersection_and_primitive_id { + typedef typename cpp11::result_of< + typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) + >::type Intersection_type; + typedef std::pair< - typename IT::variant_type, //using Intersection_traits to skip the optional + typename internal::AABB_tree::Remove_optional::type, typename Primitive::Id > Type; }; diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 6405e38f18b..ee616990276 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -238,7 +238,7 @@ public: ///@{ /// Outputs the list of all intersections, as objects of - /// `Intersection_and_primitive_id::Type`, + /// `Intersection_and_primitive_id::%Type`, /// between the query and the input data to /// the iterator. `do_intersect()` /// predicates and intersections must be defined for `Query`