mirror of https://github.com/CGAL/cgal
update how Intersection_and_primitive_id get the type and update its doc
We use meta programming to remove the optional rather than relying on Intersection_traits (since it depends on GeomTraits)
This commit is contained in:
parent
e907f9f444
commit
34362d2a0f
|
|
@ -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<Intersection_and_primitive_id<Query>::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<Intersection_and_primitive_id<Query>::%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<Object_and_primitive_id>`.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -36,6 +36,15 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
namespace internal{ namespace AABB_tree {
|
||||
template <class T>
|
||||
struct Remove_optional { typedef T type; };
|
||||
|
||||
template <class T>
|
||||
struct Remove_optional< ::boost::optional<T> > { typedef T type; };
|
||||
|
||||
} } //end of namespace internal::AABB_tree
|
||||
|
||||
/// \addtogroup PkgAABB_tree
|
||||
/// @{
|
||||
|
||||
|
|
@ -68,11 +77,18 @@ public:
|
|||
|
||||
typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> 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<Query>::%Type::first_type` is found according to
|
||||
/// the result type of `GeomTraits::Intersect_3::operator()`,
|
||||
/// (that is cpp11::result_of<GeomTraits::Intersect_3(Query, Primitive::Datum)>::type). If it is
|
||||
/// `boost::optional<T>` then it is `T`, and the result type otherwise.
|
||||
template<typename Query>
|
||||
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<Query, typename Primitive::Datum>::variant_type, //using Intersection_traits to skip the optional
|
||||
typename internal::AABB_tree::Remove_optional<Intersection_type>::type,
|
||||
typename Primitive::Id > Type;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ public:
|
|||
///@{
|
||||
|
||||
/// Outputs the list of all intersections, as objects of
|
||||
/// `Intersection_and_primitive_id<Query>::Type`,
|
||||
/// `Intersection_and_primitive_id<Query>::%Type`,
|
||||
/// between the query and the input data to
|
||||
/// the iterator. `do_intersect()`
|
||||
/// predicates and intersections must be defined for `Query`
|
||||
|
|
|
|||
Loading…
Reference in New Issue