Merge pull request #4878 from danston/Kernels-decltypes-danston

Improve decltype/result_of/invoke_result
This commit is contained in:
Laurent Rineau 2021-04-06 15:13:21 +02:00
commit 1b54449dc5
89 changed files with 501 additions and 800 deletions

View File

@ -45,11 +45,9 @@ typedef unspecified_type Do_intersect_3;
/*! /*!
A functor object to construct the intersection between two geometric objects. A functor object to construct the intersection between two geometric objects.
This functor must support the result_of protocol, that is the return
type of the `operator()(A, B)` is `CGAL::cpp11::result<Intersect_3(A,B)>`.
Provides the operators: Provides the operators:
`CGAL::cpp11::result<Intersect_3(A,B)> operator()(const A& a, const B& b);` `decltype(auto) operator()(const A& a, const B& b);`
where `A` and `B` are any relevant types among `Ray_3`, `Segment_3`, `Line_3`, where `A` and `B` are any relevant types among `Ray_3`, `Segment_3`, `Line_3`,
`Triangle_3`, `Plane_3` and `Bbox_3`. `Triangle_3`, `Plane_3` and `Bbox_3`.
Relevant herein means that a line primitive (ray, segment, line) is tested Relevant herein means that a line primitive (ray, segment, line) is tested

View File

@ -20,7 +20,6 @@
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
#include <CGAL/AABB_primitive.h> #include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator> #include <iterator>
namespace CGAL { namespace CGAL {
@ -31,14 +30,17 @@ namespace internal {
//classical typedefs //classical typedefs
typedef Iterator key_type; typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type; typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of< // typedef decltype(
typename GeomTraits::Construct_source_3(typename GeomTraits::Segment_3) // std::declval<typename GeomTraits::Construct_source_3>()(
>::type reference; // std::declval<typename GeomTraits::Segment_3>())) reference;
typedef decltype(
typename GeomTraits::Construct_source_3()(
*std::declval<key_type&>())) reference;
typedef boost::readable_property_map_tag category; typedef boost::readable_property_map_tag category;
typedef Source_of_segment_3_iterator_property_map<GeomTraits, Iterator> Self;
inline friend inline friend reference
typename Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>::reference get(Self, key_type it)
get(Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
{ {
return typename GeomTraits::Construct_source_3()( *it ); return typename GeomTraits::Construct_source_3()( *it );
} }
@ -57,7 +59,6 @@ namespace internal {
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Segment_3`. * \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Segment_3`.
* It also provides the functor `Construct_source_3` that has an operator taking a `Segment_3` * It also provides the functor `Construct_source_3` that has an operator taking a `Segment_3`
* and returning its source as a type convertible to `Point_3`. * and returning its source as a type convertible to `Point_3`.
* In addition `Construct_source_3` must support the result_of protocol.
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Segment_3` * \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Segment_3`
* \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, * \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
* the datum is stored in the primitive, while in the latter it is * the datum is stored in the primitive, while in the latter it is

View File

@ -192,14 +192,14 @@ public:
typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> Point_and_primitive_id; typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> Point_and_primitive_id;
/// `Intersection_and_primitive_id<Query>::%Type::first_type` is found according to /// `Intersection_and_primitive_id<Query>::%Type::first_type` is found according to
/// the result type of `GeomTraits::Intersect_3::operator()`, /// the result type of `GeomTraits::Intersect_3::operator()`. If it is
/// (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. /// `boost::optional<T>` then it is `T`, and the result type otherwise.
template<typename Query> template<typename Query>
struct Intersection_and_primitive_id { struct Intersection_and_primitive_id {
typedef typename cpp11::result_of< typedef decltype(
typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) std::declval<typename GeomTraits::Intersect_3>()(
>::type Intersection_type; std::declval<Query>(),
std::declval<typename Primitive::Datum>())) Intersection_type;
typedef std::pair< typedef std::pair<
typename internal::AABB_tree::Remove_optional<Intersection_type>::type, typename internal::AABB_tree::Remove_optional<Intersection_type>::type,
@ -366,8 +366,7 @@ public:
template<typename Query> template<typename Query>
boost::optional< typename Intersection_and_primitive_id<Query>::Type > boost::optional< typename Intersection_and_primitive_id<Query>::Type >
operator()(const Query& query, const typename AT::Primitive& primitive) const { operator()(const Query& query, const typename AT::Primitive& primitive) const {
typename cpp11::result_of<typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) >::type auto inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
if (!inter_res) if (!inter_res)
return boost::none; return boost::none;
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) ); return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );

View File

@ -20,7 +20,6 @@
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
#include <CGAL/AABB_primitive.h> #include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator> #include <iterator>
namespace CGAL { namespace CGAL {
@ -31,14 +30,18 @@ namespace internal {
//classical typedefs //classical typedefs
typedef Iterator key_type; typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type; typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of< // typedef decltype(
typename GeomTraits::Construct_vertex_3(typename GeomTraits::Triangle_3,int) // std::declval<typename GeomTraits::Construct_vertex_3>()(
>::type reference; // std::declval<typename GeomTraits::Triangle_3>(),
// std::declval<int>())) reference;
typedef decltype(
typename GeomTraits::Construct_vertex_3()(
*std::declval<key_type&>(), 0)) reference;
typedef boost::readable_property_map_tag category; typedef boost::readable_property_map_tag category;
typedef Point_from_triangle_3_iterator_property_map<GeomTraits, Iterator> Self;
inline friend inline friend reference
typename Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>::reference get(Self, key_type it)
get(Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
{ {
return typename GeomTraits::Construct_vertex_3()( *it, 0 ); return typename GeomTraits::Construct_vertex_3()( *it, 0 );
} }
@ -57,7 +60,6 @@ namespace internal {
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Triangle_3`. * \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Triangle_3`.
* It also provides the functor `Construct_vertex_3` that has an operator taking a `Triangle_3` * It also provides the functor `Construct_vertex_3` that has an operator taking a `Triangle_3`
* and an integer as parameters and returning a triangle point as a type convertible to `Point_3`. * and an integer as parameters and returning a triangle point as a type convertible to `Point_3`.
* In addition `Construct_vertex_3` must support the result_of protocol.
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Triangle_3` * \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Triangle_3`
* \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, * \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
* the datum is stored in the primitive, while in the latter it is * the datum is stored in the primitive, while in the latter it is

View File

@ -18,7 +18,6 @@
#include <CGAL/AABB_primitive.h> #include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator> #include <iterator>
namespace CGAL namespace CGAL
@ -31,14 +30,18 @@ namespace CGAL
//classical typedefs //classical typedefs
typedef Iterator key_type; typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type; typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of< typedef decltype(
typename GeomTraits::Construct_vertex_3(typename GeomTraits::Tetrahedron_3, int) std::declval<typename GeomTraits::Construct_vertex_3>()(
>::type reference; std::declval<typename GeomTraits::Tetrahedron_3>(),
std::declval<int>())) reference;
// typedef decltype(
// typename GeomTraits::Construct_vertex_3()(
// *std::declval<key_type&>(), 0)) reference; // fails polyhedron demo!
typedef boost::readable_property_map_tag category; typedef boost::readable_property_map_tag category;
typedef Point_from_cell_iterator_proprety_map<GeomTraits, Iterator> Self;
inline friend inline friend reference
typename Point_from_cell_iterator_proprety_map<GeomTraits, Iterator>::reference get(Self, key_type it)
get(Point_from_cell_iterator_proprety_map<GeomTraits, Iterator>, Iterator it)
{ {
typename GeomTraits::Construct_point_3 point; typename GeomTraits::Construct_point_3 point;
return point(it->vertex(1)->point()); return point(it->vertex(1)->point());

View File

@ -22,7 +22,6 @@
#include <CGAL/config.h> #include <CGAL/config.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/enum.h> #include <CGAL/enum.h>
namespace CGAL { namespace CGAL {
@ -107,25 +106,25 @@ public:
{} {}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_2(Circular_arc_2)>::type decltype(auto)
source() const source() const
{ {
return typename R::Construct_circular_source_vertex_2()(*this); return typename R::Construct_circular_source_vertex_2()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_target_vertex_2(Circular_arc_2)>::type decltype(auto)
target() const target() const
{ {
return typename R::Construct_circular_target_vertex_2()(*this); return typename R::Construct_circular_target_vertex_2()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_min_vertex_2(Circular_arc_2)>::type decltype(auto)
left() const left() const
{ {
return typename R::Construct_circular_min_vertex_2()(*this); return typename R::Construct_circular_min_vertex_2()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_max_vertex_2(Circular_arc_2)>::type decltype(auto)
right() const right() const
{ {
return typename R::Construct_circular_max_vertex_2()(*this); return typename R::Construct_circular_max_vertex_2()(*this);
@ -141,19 +140,19 @@ public:
return typename R::Is_y_monotone_2()(*this); return typename R::Is_y_monotone_2()(*this);
} }
typename cpp11::result_of<typename R::Construct_circle_2(Circular_arc_2)>::type decltype(auto)
supporting_circle() const supporting_circle() const
{ {
return typename R::Construct_circle_2()(*this); return typename R::Construct_circle_2()(*this);
} }
typename cpp11::result_of<typename R::Construct_center_2(Circular_arc_2)>::type decltype(auto)
center() const center() const
{ {
return typename R::Construct_center_2()(*this); return typename R::Construct_center_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_squared_radius_2( Circular_arc_2)>::type decltype(auto)
squared_radius() const squared_radius() const
{ {
return typename R::Compute_squared_radius_2()(*this); return typename R::Compute_squared_radius_2()(*this);

View File

@ -21,7 +21,6 @@
#include <CGAL/license/Circular_kernel_2.h> #include <CGAL/license/Circular_kernel_2.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/enum.h> #include <CGAL/enum.h>
@ -72,15 +71,13 @@ public:
: RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p)) : RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p))
{} {}
typename decltype(auto)
cpp11::result_of<typename R::Compute_circular_x_2(Circular_arc_point_2)>::type
x() const x() const
{ {
return typename R::Compute_circular_x_2()(*this); return typename R::Compute_circular_x_2()(*this);
} }
typename decltype(auto)
cpp11::result_of<typename R::Compute_circular_y_2(Circular_arc_point_2)>::type
y() const y() const
{ {
return typename R::Compute_circular_y_2()(*this); return typename R::Compute_circular_y_2()(*this);

View File

@ -639,13 +639,13 @@ public:
return _support; return _support;
} }
typename cpp11::result_of<typename CK::Construct_center_2(Circle_2)>::type decltype(auto)
center() const center() const
{ {
return supporting_circle().center(); return supporting_circle().center();
} }
typename cpp11::result_of<typename CK::Compute_squared_radius_2(Circle_2)>::type decltype(auto)
squared_radius() const squared_radius() const
{ {
return supporting_circle().squared_radius(); return supporting_circle().squared_radius();

View File

@ -357,22 +357,8 @@ namespace CircularFunctors {
//using CK::Linear_kernel::Intersect_2::operator(); //using CK::Linear_kernel::Intersect_2::operator();
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A,B)> {
typedef typename Intersection_traits<CK, A, B>::result_type type;
};
//need a specialization for the case of 3 object in CK
template<typename F, typename A, typename B, typename OutputIterator>
struct result<F(A,B,OutputIterator)> {
typedef OutputIterator type;
};
template<class A, class B> template<class A, class B>
typename Intersection_traits<CK, A, B>::result_type decltype(auto)
operator()(const A& a, const B& b) const{ operator()(const A& a, const B& b) const{
return typename CK::Linear_kernel::Intersect_2()(a,b); return typename CK::Linear_kernel::Intersect_2()(a,b);
} }
@ -482,21 +468,6 @@ namespace CircularFunctors {
{ {
public: public:
template<typename>
struct result;
template<typename F>
struct result<F(typename CK::Line_2)>
{
typedef typename CK::Polynomial_1_2 type;
};
template<typename F>
struct result<F(typename CK::Circle_2)>
{
typedef typename CK::Polynomial_for_circles_2_2 type;
};
typename CK::Polynomial_1_2 typename CK::Polynomial_1_2
operator() ( const typename CK::Line_2 & l ) operator() ( const typename CK::Line_2 & l )
{ {
@ -1014,22 +985,8 @@ namespace CircularFunctors {
typedef typename CK::Point_2 Point_2; typedef typename CK::Point_2 Point_2;
typedef typename CK::Circle_2 Circle_2; typedef typename CK::Circle_2 Circle_2;
public: public:
template<typename>
struct result{
typedef FT type;
};
template<typename F> decltype(auto)
struct result<F(Circular_arc_2)> {
typedef typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type type;
};
template<typename F>
struct result<F(Circle_2)> {
typedef typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type type;
};
typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type
operator()( const Circle_2& c) const operator()( const Circle_2& c) const
{ return LK_Compute_squared_radius_2()(c); } { return LK_Compute_squared_radius_2()(c); }
@ -1042,7 +999,7 @@ namespace CircularFunctors {
FT operator()( const Point_2& p, const Point_2& q, const Point_2& r) const FT operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
{ return LK_Compute_squared_radius_2()(p, q, r); } { return LK_Compute_squared_radius_2()(p, q, r); }
typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type decltype(auto)
operator()(const Circular_arc_2& c) const operator()(const Circular_arc_2& c) const
{ return c.rep().squared_radius(); } { return c.rep().squared_radius(); }

View File

@ -21,7 +21,6 @@
#include <CGAL/license/Circular_kernel_2.h> #include <CGAL/license/Circular_kernel_2.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
namespace CGAL { namespace CGAL {
@ -91,25 +90,25 @@ public:
: RLine_arc_2(a) : RLine_arc_2(a)
{} {}
typename cpp11::result_of< typename R::Construct_circular_source_vertex_2(Line_arc_2)>::type decltype(auto)
source() const source() const
{ {
return typename R::Construct_circular_source_vertex_2()(*this); return typename R::Construct_circular_source_vertex_2()(*this);
} }
typename cpp11::result_of< typename R::Construct_circular_target_vertex_2(Line_arc_2)>::type decltype(auto)
target() const target() const
{ {
return typename R::Construct_circular_target_vertex_2()(*this); return typename R::Construct_circular_target_vertex_2()(*this);
} }
typename cpp11::result_of< typename R::Construct_circular_min_vertex_2(Line_arc_2)>::type decltype(auto)
left() const left() const
{ {
return typename R::Construct_circular_min_vertex_2()(*this); return typename R::Construct_circular_min_vertex_2()(*this);
} }
typename cpp11::result_of< typename R::Construct_circular_max_vertex_2(Line_arc_2)>::type decltype(auto)
right() const right() const
{ {
return typename R::Construct_circular_max_vertex_2()(*this); return typename R::Construct_circular_max_vertex_2()(*this);

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h> #include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
namespace CGAL { namespace CGAL {
@ -117,19 +116,19 @@ namespace CGAL {
: RCircular_arc_3(a) : RCircular_arc_3(a)
{} {}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_3(Circular_arc_3)>::type decltype(auto)
source() const source() const
{ {
return typename R::Construct_circular_source_vertex_3()(*this); return typename R::Construct_circular_source_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_target_vertex_3(Circular_arc_3)>::type decltype(auto)
target() const target() const
{ {
return typename R::Construct_circular_target_vertex_3()(*this); return typename R::Construct_circular_target_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_circle_3(Circular_arc_3)>::type decltype(auto)
supporting_circle() const supporting_circle() const
{ {
return typename R::Construct_circle_3()(*this); return typename R::Construct_circle_3()(*this);

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h> #include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
#include <iostream> #include <iostream>
@ -196,15 +195,15 @@ public:
typename cpp11::result_of<typename R::Compute_circular_x_3(Circular_arc_point_3)>::type decltype(auto)
x() const x() const
{ return typename R::Compute_circular_x_3()(*this);} { return typename R::Compute_circular_x_3()(*this);}
typename cpp11::result_of<typename R::Compute_circular_y_3(Circular_arc_point_3)>::type decltype(auto)
y() const y() const
{ return typename R::Compute_circular_y_3()(*this);} { return typename R::Compute_circular_y_3()(*this);}
typename cpp11::result_of<typename R::Compute_circular_z_3(Circular_arc_point_3)>::type decltype(auto)
z() const z() const
{ return typename R::Compute_circular_z_3()(*this);} { return typename R::Compute_circular_z_3()(*this);}

View File

@ -567,15 +567,6 @@ template < class SK > \
typedef typename SK::Kernel_base::Circle_3 RCircle_3; typedef typename SK::Kernel_base::Circle_3 RCircle_3;
typedef typename Circle_3::Rep Rep; typedef typename Circle_3::Rep Rep;
public: public:
template<typename>
struct result {
typedef forwarded_result_type type;
};
template<typename F>
struct result<F(Circular_arc_3)> {
typedef const forwarded_result_type& type;
};
forwarded_result_type forwarded_result_type
operator()(const Point_3& p, const FT& sr, operator()(const Point_3& p, const FT& sr,
@ -1019,44 +1010,17 @@ template < class SK > \
public: public:
template <typename>
struct result;
// the binary overload always goes to Linear::Intersect_3
template <typename F, typename A, typename B>
struct result<F(A, B)>
{ typedef typename Intersection_traits<SK, A, B>::result_type type; };
// This one is only for the spherical kernel, O is an output iterator
template <typename F, typename A, typename B, typename OutputIterator>
struct result<F(A, B, OutputIterator)>
{ typedef OutputIterator type;};
// there is no quaternary form in the linear Kernel
template <typename F, typename A, typename B, typename C, typename OutputIterator>
struct result<F(A, B, C, OutputIterator)>
{ typedef OutputIterator type; };
//only ternary from the linear kernel
template<typename F>
struct result<F(Plane_3, Plane_3, Plane_3)> {
typedef boost::optional<
boost::variant< Point_3,
Line_3,
Plane_3 > > type;
};
//using SK::Linear_kernel::Intersect_3::operator(); //using SK::Linear_kernel::Intersect_3::operator();
typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3; typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3;
template<class A, class B> template<class A, class B>
typename Intersection_traits<SK, A, B>::result_type decltype(auto)
operator()(const A& a, const B& b) const{ operator()(const A& a, const B& b) const{
return Intersect_linear_3()(a,b); return Intersect_linear_3()(a,b);
} }
typename result<Intersect_linear_3(Plane_3, Plane_3, Plane_3)>::type decltype(auto)
operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const
{ {
return Intersect_linear_3()(p, q, r); return Intersect_linear_3()(p, q, r);

View File

@ -41,33 +41,6 @@ namespace CGAL {
typedef typename SK::Polynomials_for_circle_3 result_type_for_circle; typedef typename SK::Polynomials_for_circle_3 result_type_for_circle;
//using LinearFunctors::Get_equation<SK>::operator(); //using LinearFunctors::Get_equation<SK>::operator();
template <typename>
struct result;
template <typename F>
struct result<F(typename SK::Sphere_3)>
{
typedef result_type_for_sphere type;
};
template <typename F>
struct result<F(typename SK::Plane_3)>
{
typedef result_type_for_plane type;
};
template <typename F>
struct result<F(typename SK::Line_3)>
{
typedef result_type_for_line type;
};
template <typename F>
struct result<F(typename SK::Circle_3)>
{
typedef result_type_for_circle type;
};
result_type_for_sphere result_type_for_sphere
operator() ( const typename SK::Sphere_3 & s ) operator() ( const typename SK::Sphere_3 & s )
{ {

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h> #include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
@ -122,31 +121,31 @@ namespace CGAL {
: RLine_arc_3(a) : RLine_arc_3(a)
{} {}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_3(Line_arc_3)>::type decltype(auto)
source() const source() const
{ {
return typename R::Construct_circular_source_vertex_3()(*this); return typename R::Construct_circular_source_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_target_vertex_3(Line_arc_3)>::type decltype(auto)
target() const target() const
{ {
return typename R::Construct_circular_target_vertex_3()(*this); return typename R::Construct_circular_target_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_min_vertex_3(Line_arc_3)>::type decltype(auto)
lower_xyz_extremity() const lower_xyz_extremity() const
{ {
return typename R::Construct_circular_min_vertex_3()(*this); return typename R::Construct_circular_min_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_circular_max_vertex_3(Line_arc_3)>::type decltype(auto)
higher_xyz_extremity() const higher_xyz_extremity() const
{ {
return typename R::Construct_circular_max_vertex_3()(*this); return typename R::Construct_circular_max_vertex_3()(*this);
} }
typename cpp11::result_of<typename R::Construct_line_3(Line_arc_3)>::type decltype(auto)
supporting_line() const supporting_line() const
{ {
return typename R::Construct_line_3()(*this); return typename R::Construct_line_3()(*this);

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel_traits.h> #include <CGAL/Kernel_traits.h>
#include <CGAL/convex_hull_3.h> #include <CGAL/convex_hull_3.h>
#include <CGAL/result_of.h>
namespace CGAL { namespace CGAL {
namespace Convex_hull_3 { namespace Convex_hull_3 {
@ -37,14 +36,14 @@ struct Forward_functor
Forward_functor(const PointPropertyMap& vpm, const F& f) : F(f), vpm_(vpm) {} Forward_functor(const PointPropertyMap& vpm, const F& f) : F(f), vpm_(vpm) {}
template <class Vertex> template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&)>::type decltype(auto)
operator()(const Vertex& p, const Vertex& q) const operator()(const Vertex& p, const Vertex& q) const
{ {
return static_cast<const F*>(this)->operator()(get(vpm_, p), get(vpm_, q)); return static_cast<const F*>(this)->operator()(get(vpm_, p), get(vpm_, q));
} }
template <class Vertex> template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&, const Vertex&)>::type decltype(auto)
operator()(const Vertex& p, const Vertex& q, const Vertex& r) const operator()(const Vertex& p, const Vertex& q, const Vertex& r) const
{ {
return static_cast<const F*>(this)->operator()(get(vpm_, p), return static_cast<const F*>(this)->operator()(get(vpm_, p),
@ -53,7 +52,7 @@ struct Forward_functor
} }
template <class Vertex> template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&, const Vertex&, const Vertex&)>::type decltype(auto)
operator()(const Vertex& p, const Vertex& q, const Vertex& r, const Vertex& s) const operator()(const Vertex& p, const Vertex& q, const Vertex& r, const Vertex& s) const
{ {
return static_cast<const F*>(this)->operator()(get(vpm_, p), return static_cast<const F*>(this)->operator()(get(vpm_, p),

View File

@ -470,6 +470,7 @@ public:
}; };
// Macro helpers to build the kernel objects // Macro helpers to build the kernel objects
#define CGAL_PARAM(z, n, t) std::declval<t##n>()
#define CGAL_TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n; #define CGAL_TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n;
#define CGAL_TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n; #define CGAL_TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n;
#define CGAL_LEXACT(z,n,t) CGAL::exact( l##n ) #define CGAL_LEXACT(z,n,t) CGAL::exact( l##n )
@ -857,7 +858,8 @@ struct Lazy_construction_bbox
CGAL_NO_UNIQUE_ADDRESS EC ec; CGAL_NO_UNIQUE_ADDRESS EC ec;
template <typename L1> template <typename L1>
result_type operator()(const L1& l1) const decltype(auto)
operator()(const L1& l1) const
{ {
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
// Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG
@ -977,20 +979,6 @@ struct Lazy_construction_nt {
CGAL_NO_UNIQUE_ADDRESS AC ac; CGAL_NO_UNIQUE_ADDRESS AC ac;
CGAL_NO_UNIQUE_ADDRESS EC ec; CGAL_NO_UNIQUE_ADDRESS EC ec;
template<typename>
struct result { };
#define CGAL_RESULT_NT(z, n, d) \
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \
typedef Lazy_exact_nt< \
typename boost::remove_cv< typename boost::remove_reference < \
typename cpp11::result_of<EC( BOOST_PP_ENUM_PARAMS(n, E) )>::type >::type >::type > type; \
};
BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _)
template<class...L> template<class...L>
auto operator()(L const&...l) const -> auto operator()(L const&...l) const ->
Lazy_exact_nt<std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>>> Lazy_exact_nt<std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>>>
@ -1007,8 +995,6 @@ struct Lazy_construction_nt {
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( CGAL::exact(l)... )); return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( CGAL::exact(l)... ));
} }
} }
#undef CGAL_RESULT_NT
}; };
@ -1404,7 +1390,7 @@ struct Lazy_construction_object
public: public:
template <typename L1> template <typename L1>
result_type decltype(auto)
operator()(const L1& l1) const operator()(const L1& l1) const
{ {
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1437,7 +1423,7 @@ public:
} }
template <typename L1, typename L2> template <typename L1, typename L2>
result_type decltype(auto)
operator()(const L1& l1, const L2& l2) const operator()(const L1& l1, const L2& l2) const
{ {
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1491,7 +1477,7 @@ CGAL_Kernel_obj(Point_3)
} }
template <typename L1, typename L2, typename L3> template <typename L1, typename L2, typename L3>
result_type decltype(auto)
operator()(const L1& l1, const L2& l2, const L3& l3) const operator()(const L1& l1, const L2& l2, const L3& l3) const
{ {
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1530,7 +1516,7 @@ CGAL_Kernel_obj(Point_3)
//____________________________________________________________ //____________________________________________________________
// The magic functor that has Lazy<Something> as result type. // The magic functor that has Lazy<Something> as result type.
// Two versions are distinguished: one that needs to fiddle // Two versions are distinguished: one that needs to fiddle
// with result_of and another that can forward the result types. // with decltype and another that can forward the result types.
namespace internal { namespace internal {
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
@ -1652,20 +1638,23 @@ struct Lazy_construction_variant {
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \ struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \
typedef typename Type_mapper< \ typedef typename Type_mapper< \
typename cpp11::result_of<AC( BOOST_PP_ENUM_PARAMS(n, A) )>::type, AK, LK>::type type; \ decltype(std::declval<AC>()(BOOST_PP_ENUM(n, CGAL_PARAM, A))), AK, LK>::type type; \
}; };
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _)
template <typename L1, typename L2> template <typename L1, typename L2>
typename result<Lazy_construction_variant(L1, L2)>::type decltype(auto)
operator()(const L1& l1, const L2& l2) const { operator()(const L1& l1, const L2& l2) const {
typedef typename cpp11::result_of<Lazy_construction_variant(L1, L2)>::type result_type; typedef typename result<Lazy_construction_variant(L1, L2)>::type result_type;
typedef typename cpp11::result_of<AC(typename Type_mapper<L1, LK, AK>::type, // typedef decltype(std::declval<AC>()(std::declval<typename Type_mapper<L1, LK, AK>::type>(),
typename Type_mapper<L2, LK, AK>::type)>::type AT; // std::declval<typename Type_mapper<L2, LK, AK>::type>())) AT;
typedef typename cpp11::result_of<EC(typename Type_mapper<L1, LK, EK>::type, // typedef decltype(std::declval<EC>()(std::declval<typename Type_mapper<L1, LK, EK>::type>(),
typename Type_mapper<L2, LK, EK>::type)>::type ET; // std::declval<typename Type_mapper<L2, LK, EK>::type>())) ET;
typedef decltype(std::declval<AC const&>()(CGAL::approx(l1), CGAL::approx(l2))) AT;
typedef decltype(std::declval<EC const&>()( CGAL::exact(l1), CGAL::exact(l2))) ET;
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P; Protect_FPU_rounding<Protection> P;
@ -1706,19 +1695,23 @@ struct Lazy_construction_variant {
} }
template <typename L1, typename L2, typename L3> template <typename L1, typename L2, typename L3>
typename result<Lazy_construction_variant(L1, L2, L3)>::type decltype(auto)
operator()(const L1& l1, const L2& l2, const L3& l3) const { operator()(const L1& l1, const L2& l2, const L3& l3) const {
typedef typename result<Lazy_construction_variant(L1, L2, L3)>::type result_type; typedef typename result<Lazy_construction_variant(L1, L2, L3)>::type result_type;
typedef typename cpp11::result_of<AC(typename Type_mapper<L1, LK, AK>::type, // typedef decltype(std::declval<AC>()(std::declval<typename Type_mapper<L1, LK, AK>::type>(),
typename Type_mapper<L2, LK, AK>::type, // std::declval<typename Type_mapper<L2, LK, AK>::type>(),
typename Type_mapper<L3, LK, AK>::type)>::type AT; // std::declval<typename Type_mapper<L3, LK, AK>::type>())) AT;
typedef typename cpp11::result_of<EC(typename Type_mapper<L1, LK, EK>::type, // typedef decltype(std::declval<EC>()(std::declval<typename Type_mapper<L1, LK, EK>::type>(),
typename Type_mapper<L2, LK, EK>::type, // std::declval<typename Type_mapper<L2, LK, EK>::type>(),
typename Type_mapper<L3, LK, EK>::type)>::type ET; // std::declval<typename Type_mapper<L3, LK, EK>::type>())) ET;
typedef decltype(std::declval<AC const&>()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT;
typedef decltype(std::declval<EC const&>()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET;
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P; Protect_FPU_rounding<Protection> P;
try { try {
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3)); Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3));
@ -1770,7 +1763,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
typedef typename boost::remove_cv< typedef typename boost::remove_cv<
typename boost::remove_reference < typename AC::result_type >::type >::type AT; typename boost::remove_reference < typename AC::result_type >::type >::type AT;
typedef typename boost::remove_cv< typedef typename boost::remove_cv<
typename boost::remove_reference < typename EC::result_type >::type >::type ET; typename boost::remove_reference < typename EC::result_type >::type >::type ET;
typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A; typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A;
@ -1781,7 +1774,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
#define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \ #define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \ template<BOOST_PP_ENUM_PARAMS(n, class L)> \
result_type \ decltype(auto) \
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
typedef Lazy< AT, ET, E2A> Handle; \ typedef Lazy< AT, ET, E2A> Handle; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
@ -1799,7 +1792,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _)
// nullary // nullary
result_type decltype(auto)
operator()() const operator()() const
{ {
typedef Lazy<AT, ET, E2A> Handle; typedef Lazy<AT, ET, E2A> Handle;
@ -1830,27 +1823,18 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
CGAL_NO_UNIQUE_ADDRESS EC ec; CGAL_NO_UNIQUE_ADDRESS EC ec;
// acquire the result_type of the approximate kernel, map it back to the lazy kernel object // acquire the result_type of the approximate kernel, map it back to the lazy kernel object
#define CGAL_RESULT(z, n, d) \
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \
typedef typename Type_mapper< typename cpp11::result_of<AC( BOOST_PP_ENUM_PARAMS(n, A) )>::type, AK, LK>::type type; \
};
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _)
#define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \ #define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \ template<BOOST_PP_ENUM_PARAMS(n, class L)> \
typename cpp11::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type \ decltype(auto) \
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \
typedef typename boost::remove_cv< typename boost::remove_reference < \ typedef typename Type_mapper<decltype(std::declval<EC>()(BOOST_PP_ENUM(n, CGAL_PARAM, E))),EK,EK>::type ET; \
typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \ typedef typename Type_mapper<decltype(std::declval<AC>()(BOOST_PP_ENUM(n, CGAL_PARAM, A))),AK,AK>::type AT; \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
typedef Lazy< AT, ET, E2A> Handle; \ typedef Lazy< AT, ET, E2A> Handle; \
typedef typename cpp11::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \ typedef typename result<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
Protect_FPU_rounding<Protection> P; \ Protect_FPU_rounding<Protection> P; \
try { \ try { \
@ -1866,13 +1850,13 @@ struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _)
// nullary // nullary
typename Type_mapper< typename cpp11::result_of<AC()>::type ,AK, LK>::type decltype(auto)
operator()() const operator()() const
{ {
typedef typename cpp11::result_of<AC()>::type AT; typedef decltype(std::declval<AC>()()) AT;
typedef typename cpp11::result_of<EC()>::type ET; typedef decltype(std::declval<EC>()()) ET;
typedef Lazy<AT, ET, E2A> Handle; typedef Lazy<AT, ET, E2A> Handle;
typedef typename Type_mapper< typename cpp11::result_of<AC()>::type ,AK, LK>::type result_type; typedef typename Type_mapper<AT, AK, LK>::type result_type;
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) ); return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
} }

View File

@ -35,7 +35,7 @@ int main()
obj = CGAL::intersection(s1,s2); obj = CGAL::intersection(s1,s2);
// check the variant return type // check the variant return type
CGAL::cpp11::result_of<K::Intersect_2(Triangle_2, Triangle_2) >::type o_variant = CGAL::intersection(t1,t2); const auto o_variant = CGAL::intersection(t1,t2);
if(!o_variant) { if(!o_variant) {
std::cerr << "ERROR, empty" << std::endl; std::cerr << "ERROR, empty" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;
@ -75,7 +75,7 @@ int main()
} }
// check the variant return type // check the variant return type
CGAL::cpp11::result_of<K::Intersect_3(Triangle_3, Triangle_3)>::type o_variant = CGAL::intersection(t1,t2); const auto o_variant = CGAL::intersection(t1,t2);
if(!o_variant) { if(!o_variant) {
std::cerr << "ERROR, empty" << std::endl; std::cerr << "ERROR, empty" << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -18,6 +18,7 @@
#include <CGAL/generators.h> #include <CGAL/generators.h>
#include <CGAL/Random.h> #include <CGAL/Random.h>
#include <CGAL/property_map.h> #include <CGAL/property_map.h>
#include <CGAL/result_of.h>
#include <vector> #include <vector>

View File

@ -17,7 +17,6 @@
#include <CGAL/Object.h> #include <CGAL/Object.h>
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
@ -41,13 +40,13 @@
#define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \ #define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \
template<typename K> \ template<typename K> \
inline \ inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \ decltype(auto) \
intersection(const A<K>& a, const B<K>& b) { \ intersection(const A<K>& a, const B<K>& b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
} \ } \
template<typename K> \ template<typename K> \
inline \ inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \ decltype(auto) \
intersection(const B<K>& a, const A<K>& b) { \ intersection(const B<K>& a, const A<K>& b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
} }
@ -55,7 +54,7 @@
#define CGAL_INTERSECTION_FUNCTION_SELF(A, DIM) \ #define CGAL_INTERSECTION_FUNCTION_SELF(A, DIM) \
template<typename K> \ template<typename K> \
inline \ inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::A)>::type \ decltype(auto) \
intersection(const A<K> & a, const A<K> & b) { \ intersection(const A<K> & a, const A<K> & b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
} }
@ -123,11 +122,11 @@ namespace internal {
// the real type. // the real type.
// Overloads for empty returns are also provided. // Overloads for empty returns are also provided.
template<typename F, typename A, typename B, typename T> template<typename F, typename A, typename B, typename T>
inline typename cpp11::result_of<F(A, B)>::type decltype(auto)
intersection_return(T&& t) { return typename cpp11::result_of<F(A, B)>::type(std::forward<T>(t)); } intersection_return(T&& t) { return decltype(std::declval<F>()(std::declval<A>(), std::declval<B>()))(std::forward<T>(t)); }
template<typename F, typename A, typename B> template<typename F, typename A, typename B>
inline typename cpp11::result_of<F(A, B)>::type decltype(auto)
intersection_return() { return typename cpp11::result_of<F(A, B)>::type(); } intersection_return() { return decltype(std::declval<F>()(std::declval<A>(), std::declval<B>()))(); }
// Something similar to wrap around boost::get and object_cast to // Something similar to wrap around boost::get and object_cast to
// prevent ifdefing too much. Another way could be to introduce an // prevent ifdefing too much. Another way could be to introduce an
@ -153,14 +152,14 @@ const T* intersect_get(const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)> & v) {
} }
template<typename A, typename B> template<typename A, typename B>
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_2(A, B)>::type decltype(auto)
intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel; typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().intersect_2_object()(a, b); return Kernel().intersect_2_object()(a, b);
} }
template<typename A, typename B> template<typename A, typename B>
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_3(A, B)>::type decltype(auto)
intersection_impl(const A& a, const B& b, Dimension_tag<3>) { intersection_impl(const A& a, const B& b, Dimension_tag<3>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel; typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().intersect_3_object()(a, b); return Kernel().intersect_3_object()(a, b);

View File

@ -57,7 +57,7 @@ namespace CGAL {
// the special plane_3 function // the special plane_3 function
template <class K> template <class K>
inline inline
typename cpp11::result_of<typename K::Intersect_3(typename K::Plane_3, typename K::Plane_3, typename K::Plane_3)>::type decltype(auto)
intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2, intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2,
const Plane_3<K> &plane3) const Plane_3<K> &plane3)
{ {

View File

@ -25,9 +25,9 @@ typedef CGAL::Bbox_3 Bbox_3;
template<class A, class B> template<class A, class B>
void call_intersection_global(const A& a, const B& b) { void call_intersection_global(const A& a, const B& b) {
typename CGAL::cpp11::result_of<K::Intersect_3(A, B)>::type x = CGAL::intersection(a, b); const auto x = CGAL::intersection(a, b);
typename CGAL::cpp11::result_of<K::Intersect_3(A, B)>::type y = CGAL::intersection(b, a); const auto y = CGAL::intersection(b, a);
typename CGAL::cpp11::result_of<K::Intersect_3(B, A)>::type z = CGAL::intersection(b, a); const auto z = CGAL::intersection(b, a);
CGAL_USE(x); CGAL_USE(x);
CGAL_USE(y); CGAL_USE(y);
CGAL_USE(z); CGAL_USE(z);
@ -42,8 +42,8 @@ void call_do_intersect_global(const A& a, const B& b) {
template<class A, class B, class K> template<class A, class B, class K>
void call_intersection_with_kernel(const A& a, const B& b, const K&) { void call_intersection_with_kernel(const A& a, const B& b, const K&) {
typedef typename K::Intersect_3 Intersect; typedef typename K::Intersect_3 Intersect;
typename CGAL::cpp11::result_of<Intersect(A, B)>::type x = Intersect()(a, b); const auto x = Intersect()(a, b);
typename CGAL::cpp11::result_of<Intersect(A, B)>::type y = Intersect()(b, a); const auto y = Intersect()(b, a);
} }
template<class A, class B, class K> template<class A, class B, class K>
@ -83,7 +83,7 @@ int main(int argc, char**)
// call_intersection_global(Pl(), Cub()); // call_intersection_global(Pl(), Cub());
// special // special
CGAL::cpp11::result_of<K::Intersect_3(Pl, Pl, Pl)>::type plplpl = CGAL::intersection(Pl(), Pl(), Pl()); const auto plplpl = CGAL::intersection(Pl(), Pl(), Pl());
call_intersection_global(Tr(), S()); call_intersection_global(Tr(), S());
call_intersection_global(Tr(), L()); call_intersection_global(Tr(), L());

View File

@ -46,10 +46,9 @@ the following function overloads are also available.
The iterator versions of those functions can be used in conjunction The iterator versions of those functions can be used in conjunction
with `Dispatch_output_iterator`. with `Dispatch_output_iterator`.
Since both the number of intersections, if any, and their types, depend Since both the number of intersections, if any, and types of the interesection results
on the arguments, the function expects an output iterator on depend on the arguments, the function expects an output iterator on `K::Intersect_2(Type1, Type2)`
`cpp11::result_of<K::Intersect_2(Type1, Type2)>::%type`, as as presented below.
presented below.
*/ */
/// @{ /// @{

View File

@ -57,20 +57,16 @@ the following function overloads are also available.
The iterator versions of those functions can be used in conjunction The iterator versions of those functions can be used in conjunction
with `Dispatch_output_iterator`. with `Dispatch_output_iterator`.
Since both the number of intersections, if any, and their types, depend Since both the number of intersections, if any, and types of the interesection results
on the arguments, the function expects an output iterator on depend on the arguments, the function expects an output iterator on `Kernel::Intersect_3(Type1, Type2)`
`cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>::%type`,
as presented below. as presented below.
*/ */
/// @{ /// @{
/*! /*!
Copies in the output iterator the intersection elements between the Constructs the intersection elements between the two input
two objects. `intersections` iterates on objects and stores them in the OutputIterator in lexicographic order,
elements of type `result_of< Intersect_3(SphericalType1, SphericalType2) >`, in lexicographic order, where both, `SphericalType1` and `SphericalType2`, can be either
when this ordering is defined on the computed objects,
where `SphericalType1` and `SphericalType2` can both be one of:
- `Sphere_3<SphericalKernel>`, - `Sphere_3<SphericalKernel>`,
- `Plane_3<SphericalKernel>`, - `Plane_3<SphericalKernel>`,
@ -90,7 +86,7 @@ type can be
and if the two objets `obj1` and `obj2` are equal, and if the two objets `obj1` and `obj2` are equal,
- `Line_3<SphericalKernel>` or - `Line_3<SphericalKernel>` or
`Circle_3<SphericalKernel>` when `SphericalType1` and `SphericalType2` `Circle_3<SphericalKernel>` when `SphericalType1` and `SphericalType2`
are two-dimensional objets intersecting along a curve (2 planes, or 2 are two-dimensional objects intersecting along a curve (2 planes, or 2
spheres, or one plane and one sphere), spheres, or one plane and one sphere),
- `Circular_arc_3<SphericalKernel>` in case of an overlap of - `Circular_arc_3<SphericalKernel>` in case of an overlap of
two circular arcs or two circular arcs or

View File

@ -101,12 +101,15 @@ The following tables give the possible values for `Type1` and `Type2`.
\cgalHeading{2D Intersections} \cgalHeading{2D Intersections}
The return type can be obtained through `CGAL::cpp11::result_of<Kernel::Intersect_2(A, B)>::%type`. The return type of intersecting two objects of the types `Type1` and `Type2` can be
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER"> <DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1"> <TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH> <TR>
<TH> Type1 </TH>
<TH> Type2 </TH> <TH> Type2 </TH>
<TH> Return Type: `T...` </TH> <TH> Return Type: `T...` </TH>
</TR> </TR>
@ -197,12 +200,15 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ
\cgalHeading{3D Intersections} \cgalHeading{3D Intersections}
The return type can be obtained through `CGAL::cpp11::result_of<Kernel::Intersect_3(A, B)>::%type`. The return type of intersecting two objects of the types `Type1` and `Type2` can be
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER"> <DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1"> <TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH> <TR>
<TH> Type1 </TH>
<TH> Type2 </TH> <TH> Type2 </TH>
<TH> Return Type: `T...` </TH> <TH> Return Type: `T...` </TH>
</TR> </TR>
@ -356,9 +362,9 @@ The following examples demonstrate the most common use of
`intersection()` functions with the 2D and 3D Linear %Kernel. `intersection()` functions with the 2D and 3D Linear %Kernel.
In the first two examples we intersect a segment and a line. In the first two examples we intersect a segment and a line.
The result type can be obtained with `CGAL::cpp11::result_of`. It looks simpler The result type can be specified through the placeholder type specifier `auto`,
if you use a C++ compiler which supports `auto`, but you must anyway know that the result type is a `boost::optional<boost::variant<..> >`,
but you must anyways know that the result type is a `boost::optional<boost::variant<..> >`, in order to unpack the point or segment. in order to unpack the point or segment.
<A HREF="https://www.boost.org/libs/optional/">`boost::optional`</A> comes in <A HREF="https://www.boost.org/libs/optional/">`boost::optional`</A> comes in
as there might be no intersection. <A HREF="https://www.boost.org/libs/variant/">`boost::variant`</A> comes in as there might be no intersection. <A HREF="https://www.boost.org/libs/variant/">`boost::variant`</A> comes in
@ -380,7 +386,7 @@ a standard library algorithm.
*/ */
template <typename Kernel> template <typename Kernel>
cpp11::result_of<Kernel::Intersect_23(Type1, Type2)>::type decltype(auto)
intersection(Type1<Kernel> obj1, Type2<Kernel> obj2); intersection(Type1<Kernel> obj1, Type2<Kernel> obj2);
/*! /*!
@ -388,7 +394,7 @@ returns the intersection of 3 planes, which can be a
point, a line, a plane, or empty. point, a line, a plane, or empty.
*/ */
template <typename Kernel> template <typename Kernel>
boost::optional< boost::variant< Point_3, Line_3, Plane_3 > > decltype(auto)
intersection(const Plane_3<Kernel>& pl1, intersection(const Plane_3<Kernel>& pl1,
const Plane_3<Kernel>& pl2, const Plane_3<Kernel>& pl2,
const Plane_3<Kernel>& pl3); const Plane_3<Kernel>& pl3);

View File

@ -8409,8 +8409,6 @@ public:
\cgalRefines `AdaptableFunctor` (with two arguments) \cgalRefines `AdaptableFunctor` (with two arguments)
\sa \link intersection_grp `CGAL::intersection()` \endlink \sa \link intersection_grp `CGAL::intersection()` \endlink
\sa `CGAL::cpp11::result_of`
*/ */
class Intersect_2 { class Intersect_2 {
public: public:
@ -8424,7 +8422,7 @@ public:
`Type1` and `Type2`, for all pairs `Type1` and `Type2`. `Type1` and `Type2`, for all pairs `Type1` and `Type2`.
For details see the reference manual page for \link intersection_grp `CGAL::intersection()` \endlink. For details see the reference manual page for \link intersection_grp `CGAL::intersection()` \endlink.
*/ */
CGAL::cpp11::result_of<Kernel::Intersect_2(Type1, Type2)>::type decltype(auto)
operator()(Type1 obj1, Type2 obj2); operator()(Type1 obj1, Type2 obj2);
/// @} /// @}
@ -8438,8 +8436,6 @@ public:
\cgalRefines `AdaptableFunctor` (with two or three arguments) \cgalRefines `AdaptableFunctor` (with two or three arguments)
\sa intersection_linear_grp \sa intersection_linear_grp
\sa `CGAL::cpp11::result_of`
*/ */
class Intersect_3 { class Intersect_3 {
public: public:
@ -8453,8 +8449,8 @@ public:
objects of type `Type1` and `Type2`. objects of type `Type1` and `Type2`.
For details see the reference manual page for \ref intersection_linear_grp. For details see the reference manual page for \ref intersection_linear_grp.
*/ */
CGAL::cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>::type decltype(auto)
operator()(Type1 obj1, Type2 obj2); operator()(Type1 obj1, Type2 obj2);

View File

@ -493,23 +493,19 @@ especially integer types and rationals.
\subsection Kernel_23VariantReturnValues Intersections and Variant Return Types \subsection Kernel_23VariantReturnValues Intersections and Variant Return Types
Some functions, for example \link intersection_linear_grp `intersection()`\endlink, can return different types of objects. To achieve this Some functions, for example \link intersection_linear_grp `intersection()`\endlink,
in a type-safe way \cgal uses return values of type can return different types of objects. To achieve this in a type-safe way \cgal uses
`boost::optional< boost::variant< T... > >` were `T...` is a return values of type `boost::optional< boost::variant< T... > >` where `T...` is a
list of all possible resulting geometric objects. The exact result list of all possible resulting geometric objects. The exact result type of an intersection
type of an intersection can be determined through the metafunction can be specified through the placeholder type specifier `auto`.
`cpp11::result_of<Kernel::Intersect_2(Type1, Type2)>` or
`cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>`, where
`Type1` and `Type2` are the types of the objects used in the
intersection computation.
Example Example
------- -------
In the following example, `result_of` is used to query the type of the In the following example, `auto` is used to specify the type of the return value
return value for the intersection computation: for the intersection computation:
\code{.cpp} \code{.cpp}
typedef Cartesian<double> K; typedef Cartesian<double> K;
@ -521,13 +517,9 @@ Segment_2 segment_1, segment_2;
std::cin >> segment_1 >> segment_2; std::cin >> segment_1 >> segment_2;
/* C++11 */ /* use auto */
// auto v = intersection(segment_1, segment_2); auto v = intersection(segment_1, segment_2);
if (v) {
/* C++03 */
cpp11::result_of<K::Intersect_2(Segment_2, Segment_2)>::type
v = intersection(segment_1, segment_2);
if(v) {
/* not empty */ /* not empty */
if (const Point_2 *p = boost::get<Point_2>(&*v) ) { if (const Point_2 *p = boost::get<Point_2>(&*v) ) {
/* do something with *p */ /* do something with *p */

View File

@ -56,8 +56,7 @@ int main()
K::Intersect_2 intersection; K::Intersect_2 intersection;
CGAL::cpp11::result_of<K::Intersect_2(Segment, Segment)>::type const auto intersect = intersection(s1, s2);
intersect = intersection(s1, s2);
K::Construct_cartesian_const_iterator_2 construct_it; K::Construct_cartesian_const_iterator_2 construct_it;
K::Cartesian_const_iterator_2 cit = construct_it(a); K::Cartesian_const_iterator_2 cit = construct_it(a);

View File

@ -25,8 +25,7 @@ int main(){
EK::Triangle_3 t2=to_exact(t1); EK::Triangle_3 t2=to_exact(t1);
EK::Line_3 l2=to_exact(l1); EK::Line_3 l2=to_exact(l1);
CGAL::cpp11::result_of<EK::Intersect_3(EK::Triangle_3, EK::Line_3)>::type const auto inter = CGAL::intersection(t2,l2);
inter = CGAL::intersection(t2,l2);
// As we are sure that there IS an intersection // As we are sure that there IS an intersection
// and that the intersection IS a point // and that the intersection IS a point

View File

@ -12,8 +12,7 @@ int main()
Segment_2 seg(Point_2(0,0), Point_2(2,2)); Segment_2 seg(Point_2(0,0), Point_2(2,2));
Line_2 lin(1,-1,0); Line_2 lin(1,-1,0);
CGAL::cpp11::result_of<Intersect_2(Segment_2, Line_2)>::type const auto result = intersection(seg, lin);
result = intersection(seg, lin);
if (result) { if (result) {
if (const Segment_2* s = boost::get<Segment_2>(&*result)) { if (const Segment_2* s = boost::get<Segment_2>(&*result)) {
std::cout << *s << std::endl; std::cout << *s << std::endl;

View File

@ -26,11 +26,7 @@ int main()
Segment_2 seg(Point_2(0,0), Point_2(1,1)); Segment_2 seg(Point_2(0,0), Point_2(1,1));
Line_2 lin(1,-1,0); Line_2 lin(1,-1,0);
// with C++11 support const auto result = intersection(seg, lin);
// auto result = intersection(seg, lin);
// without C++11
CGAL::cpp11::result_of<Intersect_2(Segment_2, Line_2)>::type
result = intersection(seg, lin);
if (result) { if (result) {
boost::apply_visitor(Intersection_visitor(), *result); boost::apply_visitor(Intersection_visitor(), *result);
} else { } else {

View File

@ -13,13 +13,12 @@ typedef CGAL::Creator_uniform_2< Point, Segment> Seg_creator;
typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator;
struct Intersector{ struct Intersector{
typedef CGAL::cpp11::result_of<K::Intersect_2(Segment,Segment)>::type result_type;
const Segment& s; const Segment& s;
K::Intersect_2 intersect; K::Intersect_2 intersect;
Intersector(const Segment& seg): s(seg) {} Intersector(const Segment& seg): s(seg) {}
result_type decltype(auto)
operator() ( const Segment& other) const operator() ( const Segment& other) const
{ {
return intersect(s, other); return intersect(s, other);

View File

@ -18,7 +18,6 @@
#include <CGAL/config.h> #include <CGAL/config.h>
#include <CGAL/kernel_assertions.h> #include <CGAL/kernel_assertions.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/array.h> #include <CGAL/array.h>

View File

@ -24,7 +24,6 @@
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/number_utils.h> #include <CGAL/number_utils.h>
#include <CGAL/result_of.h>
namespace CGAL { namespace CGAL {
@ -89,13 +88,13 @@ public:
Circle_2(const Point_2 & center) Circle_2(const Point_2 & center)
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {} : RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {}
typename cpp11::result_of<typename R::Construct_center_2(Circle_2)>::type decltype(auto)
center() const center() const
{ {
return R().construct_center_2_object()(*this); return R().construct_center_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_squared_radius_2(Circle_2)>::type decltype(auto)
squared_radius() const squared_radius() const
{ {
return R().compute_squared_radius_2_object()(*this); return R().compute_squared_radius_2_object()(*this);

View File

@ -93,8 +93,7 @@ public:
Circle_3(const Rep& r) Circle_3(const Rep& r)
: Rep(r) {} : Rep(r) {}
typename cpp11::result_of decltype(auto)
<typename R::Construct_sphere_3( Circle_3)>::type
diametral_sphere() const diametral_sphere() const
{ {
return typename R::Construct_sphere_3()(*this); return typename R::Construct_sphere_3()(*this);
@ -110,8 +109,7 @@ public:
return typename R::Construct_sphere_3()(*this).squared_radius(); return typename R::Construct_sphere_3()(*this).squared_radius();
} }
typename cpp11::result_of decltype(auto)
<typename R::Construct_plane_3( Circle_3)>::type
supporting_plane() const supporting_plane() const
{ {
return typename R::Construct_plane_3()(*this); return typename R::Construct_plane_3()(*this);

View File

@ -23,7 +23,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -93,19 +92,19 @@ public:
return R().construct_perpendicular_direction_2_object()(*this,o); return R().construct_perpendicular_direction_2_object()(*this,o);
} }
typename cpp11::result_of<typename R::Compute_dx_2( Direction_2)>::type decltype(auto)
dx() const dx() const
{ {
return R().compute_dx_2_object()(*this); return R().compute_dx_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_dy_2( Direction_2)>::type decltype(auto)
dy() const dy() const
{ {
return R().compute_dy_2_object()(*this); return R().compute_dy_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_dx_2( Direction_2)>::type decltype(auto)
delta(int i) const delta(int i) const
{ {
CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) ); CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) );

View File

@ -23,7 +23,6 @@
#include <CGAL/kernel_assertions.h> #include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -99,25 +98,25 @@ public:
Vector_3 vector() const { return to_vector(); } Vector_3 vector() const { return to_vector(); }
typename cpp11::result_of<typename R::Compute_dx_3(Direction_3)>::type decltype(auto)
dx() const dx() const
{ {
return R().compute_dx_3_object()(*this); return R().compute_dx_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_dy_3(Direction_3)>::type decltype(auto)
dy() const dy() const
{ {
return R().compute_dy_3_object()(*this); return R().compute_dy_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_dz_3(Direction_3)>::type decltype(auto)
dz() const dz() const
{ {
return R().compute_dz_3_object()(*this); return R().compute_dz_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_dx_3(Direction_3)>::type decltype(auto)
delta(int i) const delta(int i) const
{ {
CGAL_kernel_precondition( i >= 0 && i <= 2 ); CGAL_kernel_precondition( i >= 0 && i <= 2 );

View File

@ -86,67 +86,67 @@ public:
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.zmin(), : Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.zmin(),
bbox.xmax(), bbox.ymax(), bbox.zmax())) {} bbox.xmax(), bbox.ymax(), bbox.zmax())) {}
typename cpp11::result_of<typename R::Construct_min_vertex_3( Iso_cuboid_3 )>::type decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION () const min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ {
return R().construct_min_vertex_3_object()(*this); return R().construct_min_vertex_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_max_vertex_3( Iso_cuboid_3 )>::type decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ {
return R().construct_max_vertex_3_object()(*this); return R().construct_max_vertex_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Iso_cuboid_3, int )>::type decltype(auto)
vertex(int i) const vertex(int i) const
{ {
return R().construct_vertex_3_object()(*this,i); return R().construct_vertex_3_object()(*this,i);
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Iso_cuboid_3, int )>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return R().construct_vertex_3_object()(*this,i); return R().construct_vertex_3_object()(*this,i);
} }
typename cpp11::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type decltype(auto)
xmin() const xmin() const
{ {
return R().compute_xmin_3_object()(*this); return R().compute_xmin_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type decltype(auto)
xmax() const xmax() const
{ {
return R().compute_xmax_3_object()(*this); return R().compute_xmax_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_ymin_3( Iso_cuboid_3 )>::type decltype(auto)
ymin() const ymin() const
{ {
return R().compute_ymin_3_object()(*this); return R().compute_ymin_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_ymax_3( Iso_cuboid_3 )>::type decltype(auto)
ymax() const ymax() const
{ {
return R().compute_ymax_3_object()(*this); return R().compute_ymax_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_zmin_3( Iso_cuboid_3 )>::type decltype(auto)
zmin() const zmin() const
{ {
return R().compute_zmin_3_object()(*this); return R().compute_zmin_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_zmax_3( Iso_cuboid_3 )>::type decltype(auto)
zmax() const zmax() const
{ {
return R().compute_zmax_3_object()(*this); return R().compute_zmax_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type decltype(auto)
min_coord(int i) const min_coord(int i) const
{ {
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -158,7 +158,7 @@ public:
return zmin(); return zmin();
} }
typename cpp11::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type decltype(auto)
max_coord(int i) const max_coord(int i) const
{ {
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -206,7 +206,7 @@ public:
return R().is_degenerate_3_object()(*this); return R().is_degenerate_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_volume_3( Iso_cuboid_3 )>::type decltype(auto)
volume() const volume() const
{ {
return R().compute_volume_3_object()(*this); return R().compute_volume_3_object()(*this);

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
namespace CGAL { namespace CGAL {
@ -82,13 +81,13 @@ public:
Iso_rectangle_2(const Bbox_2& bbox) Iso_rectangle_2(const Bbox_2& bbox)
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.xmax(), bbox.ymax())) {} : Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.xmax(), bbox.ymax())) {}
typename cpp11::result_of<typename R::Construct_min_vertex_2( Iso_rectangle_2 )>::type decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION () const min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ {
return R().construct_min_vertex_2_object()(*this); return R().construct_min_vertex_2_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_max_vertex_2( Iso_rectangle_2 )>::type decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{ {
return R().construct_max_vertex_2_object()(*this); return R().construct_max_vertex_2_object()(*this);
@ -107,43 +106,43 @@ public:
} }
typename cpp11::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type decltype(auto)
vertex(int i) const vertex(int i) const
{ {
return R().construct_vertex_2_object()(*this,i); return R().construct_vertex_2_object()(*this,i);
} }
typename cpp11::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return R().construct_vertex_2_object()(*this,i); return R().construct_vertex_2_object()(*this,i);
} }
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type decltype(auto)
xmin() const xmin() const
{ {
return R().compute_xmin_2_object()(*this); return R().compute_xmin_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_xmax_2( Iso_rectangle_2 )>::type decltype(auto)
xmax() const xmax() const
{ {
return R().compute_xmax_2_object()(*this); return R().compute_xmax_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_ymin_2( Iso_rectangle_2 )>::type decltype(auto)
ymin() const ymin() const
{ {
return R().compute_ymin_2_object()(*this); return R().compute_ymin_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_ymax_2( Iso_rectangle_2 )>::type decltype(auto)
ymax() const ymax() const
{ {
return R().compute_ymax_2_object()(*this); return R().compute_ymax_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type decltype(auto)
min_coord(int i) const min_coord(int i) const
{ {
CGAL_kernel_precondition( i == 0 || i == 1 ); CGAL_kernel_precondition( i == 0 || i == 1 );
@ -153,7 +152,7 @@ public:
return ymin(); return ymin();
} }
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type decltype(auto)
max_coord(int i) const max_coord(int i) const
{ {
CGAL_kernel_precondition( i == 0 || i == 1 ); CGAL_kernel_precondition( i == 0 || i == 1 );

View File

@ -87,9 +87,13 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _)
//}; //};
// Then we specialize for all kernel objects. // Then we specialize for all kernel objects.
// More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501
#define CGAL_Kernel_obj(X) \ #define CGAL_Kernel_obj(X) \
template < typename K1, typename K2 > \ template < typename K1, typename K2 > \
struct Type_mapper_impl < typename K1::X, K1, K2 > \ struct Type_mapper_impl < typename K1::X, K1, K2 > \
{ typedef typename K2::X type; }; \
template < typename K1, typename K2 > \
struct Type_mapper_impl < typename K1::X::Rep, K1, K2 > \
{ typedef typename K2::X type; }; { typedef typename K2::X type; };
#include <CGAL/Kernel/interface_macros.h> #include <CGAL/Kernel/interface_macros.h>

View File

@ -1715,8 +1715,7 @@ namespace CommonKernelFunctors {
Line l1 = construct_line(l11, l12); Line l1 = construct_line(l11, l12);
Line l2 = construct_line(l21, l22); Line l2 = construct_line(l21, l22);
typename cpp11::result_of<typename K::Intersect_3(Line,Line)>::type const auto res = typename K::Intersect_3()(l1,l2);
res = typename K::Intersect_3()(l1,l2);
CGAL_assertion(res!=boost::none); CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res)); const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr); CGAL_assertion(e_pt!=nullptr);
@ -2115,8 +2114,7 @@ namespace CommonKernelFunctors {
Plane plane = construct_plane(p1, p2, p3); Plane plane = construct_plane(p1, p2, p3);
Line line = construct_line( l1, l2 ); Line line = construct_line( l1, l2 );
typename cpp11::result_of<typename K::Intersect_3(Plane,Line)>::type const auto res = typename K::Intersect_3()(plane,line);
res = typename K::Intersect_3()(plane,line);
CGAL_assertion(res!=boost::none); CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res)); const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr); CGAL_assertion(e_pt!=nullptr);
@ -2129,8 +2127,7 @@ namespace CommonKernelFunctors {
{ {
Line line = construct_line( l1, l2 ); Line line = construct_line( l1, l2 );
typename cpp11::result_of<typename K::Intersect_3(Plane,Line)>::type const auto res = typename K::Intersect_3()(plane,line);
res = typename K::Intersect_3()(plane,line);
CGAL_assertion(res!=boost::none); CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res)); const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr); CGAL_assertion(e_pt!=nullptr);
@ -2593,15 +2590,6 @@ namespace CommonKernelFunctors {
typedef typename K::Triangle_3 Triangle_3; typedef typename K::Triangle_3 Triangle_3;
typedef typename K::Tetrahedron_3 Tetrahedron_3; typedef typename K::Tetrahedron_3 Tetrahedron_3;
public: public:
template<typename>
struct result {
typedef const Point_3& type;
};
template<typename T>
struct result<T(Iso_cuboid_3, int)> {
typedef Point_3 type;
};
const Point_3& const Point_3&
operator()( const Segment_3& s, int i) const operator()( const Segment_3& s, int i) const
@ -3332,11 +3320,10 @@ namespace CommonKernelFunctors {
bool operator()(const Sphere_3& s1, const Sphere_3& s2, bool operator()(const Sphere_3& s1, const Sphere_3& s2,
const Point_3& a, const Point_3& b) const const Point_3& a, const Point_3& b) const
{ {
typedef typename K::Circle_3 Circle_3; typedef typename K::Circle_3 Circle_3;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
typedef typename K::Segment_3 Segment_3; typedef typename K::Segment_3 Segment_3;
typedef typename K::Plane_3 Plane_3; typedef typename K::Plane_3 Plane_3;
typedef typename K::Intersect_3 Intersect_3;
const Has_on_bounded_side_3& has_on_bounded_side = *this; const Has_on_bounded_side_3& has_on_bounded_side = *this;
@ -3356,8 +3343,7 @@ namespace CommonKernelFunctors {
if(!K().do_intersect_3_object()(s1, s2)) return false; if(!K().do_intersect_3_object()(s1, s2)) return false;
const Circle_3 circ(s1, s2); const Circle_3 circ(s1, s2);
const Plane_3& plane = circ.supporting_plane(); const Plane_3& plane = circ.supporting_plane();
typename CGAL::cpp11::result_of<Intersect_3(Plane_3, Segment_3)>::type const auto optional = K().intersect_3_object()(plane, Segment_3(a, b));
optional = K().intersect_3_object()(plane, Segment_3(a, b));
CGAL_kernel_assertion_msg(bool(optional) == true, CGAL_kernel_assertion_msg(bool(optional) == true,
"the segment does not intersect the supporting" "the segment does not intersect the supporting"
" plane"); " plane");
@ -3548,17 +3534,10 @@ namespace CommonKernelFunctors {
class Intersect_2 class Intersect_2
{ {
public: public:
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A,B)> {
typedef typename Intersection_traits<K, A, B>::result_type type;
};
// 25 possibilities, so I keep the template. // 25 possibilities, so I keep the template.
template <class T1, class T2> template <class T1, class T2>
typename Intersection_traits<K, T1, T2>::result_type decltype(auto)
operator()(const T1& t1, const T2& t2) const operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::intersection(t1, t2, K()); } { return Intersections::internal::intersection(t1, t2, K()); }
}; };
@ -3568,29 +3547,14 @@ namespace CommonKernelFunctors {
{ {
typedef typename K::Plane_3 Plane_3; typedef typename K::Plane_3 Plane_3;
public: public:
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename Intersection_traits<K, A, B>::result_type type;
};
template<typename F>
struct result<F(Plane_3, Plane_3, Plane_3)> {
typedef boost::optional<
boost::variant< typename K::Point_3,
typename K::Line_3,
typename K::Plane_3 > > type;
};
// n possibilities, so I keep the template. // n possibilities, so I keep the template.
template <class T1, class T2> template <class T1, class T2>
typename cpp11::result_of< Intersect_3(T1, T2) >::type decltype(auto)
operator()(const T1& t1, const T2& t2) const operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::intersection(t1, t2, K() ); } { return Intersections::internal::intersection(t1, t2, K() ); }
typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > > decltype(auto)
operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const
{ return Intersections::internal::intersection(pl1, pl2, pl3, K() ); } { return Intersections::internal::intersection(pl1, pl2, pl3, K() ); }
}; };

View File

@ -21,7 +21,6 @@
// This file contains the definition of a kernel traits checker. // This file contains the definition of a kernel traits checker.
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/result_of.h>
#include <CGAL/use.h> #include <CGAL/use.h>
#include <utility> #include <utility>
@ -80,19 +79,14 @@ public:
{ } { }
template <class ... A> template <class ... A>
typename Pairify<typename CGAL::cpp11::result_of<P1(const A&...)>::type, decltype(auto)
typename CGAL::cpp11::result_of<P2(const A&...)>::type>::result_type
operator()(const A&... a) const operator()(const A&... a) const
{ {
typedef typename CGAL::cpp11::result_of<P1(const A&...)>::type result_type_1; auto res1 = p1(a.first...);
typedef typename CGAL::cpp11::result_of<P2(const A&...)>::type result_type_2; auto res2 = p2(a.second...);
result_type_1 res1 = p1(a.first...);
result_type_2 res2 = p2(a.second...); CGAL_kernel_assertion(cmp(res1, res2));
if (! cmp(res1, res2)) return Pairify<decltype(res1), decltype(res2)>()(res1, res2);
{
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
} }
}; };

View File

@ -21,7 +21,6 @@
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -107,25 +106,25 @@ public:
return Direction_3(a(), b(), c()); return Direction_3(a(), b(), c());
} }
typename cpp11::result_of<typename R::Compute_a_3( Plane_3)>::type decltype(auto)
a() const a() const
{ {
return R().compute_a_3_object()(*this); return R().compute_a_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_b_3( Plane_3)>::type decltype(auto)
b() const b() const
{ {
return R().compute_b_3_object()(*this); return R().compute_b_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_c_3( Plane_3)>::type decltype(auto)
c() const c() const
{ {
return R().compute_c_3_object()(*this); return R().compute_c_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_d_3( Plane_3)>::type decltype(auto)
d() const d() const
{ {
return R().compute_d_3_object()(*this); return R().compute_d_3_object()(*this);

View File

@ -24,7 +24,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
namespace CGAL { namespace CGAL {
@ -93,26 +92,26 @@ public:
swap(a.rep(), b.rep()); swap(a.rep(), b.rep());
} }
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type decltype(auto)
x() const x() const
{ {
return typename R::Compute_x_2()(*this); return typename R::Compute_x_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_y_2(Point_2)>::type decltype(auto)
y() const y() const
{ {
return typename R::Compute_y_2()(*this); return typename R::Compute_y_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) ); CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y(); return (i==0) ? x() : y();
} }
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);
@ -129,19 +128,19 @@ public:
} }
typename cpp11::result_of<typename R::Compute_hx_2(Point_2)>::type decltype(auto)
hx() const hx() const
{ {
return typename R::Compute_hx_2()(*this); return typename R::Compute_hx_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_hy_2(Point_2)>::type decltype(auto)
hy() const hy() const
{ {
return typename R::Compute_hy_2()(*this); return typename R::Compute_hy_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_hw_2(Point_2)>::type decltype(auto)
hw() const hw() const
{ {
return typename R::Compute_hw_2()(*this); return typename R::Compute_hw_2()(*this);
@ -152,7 +151,7 @@ public:
return 2; return 2;
} }
typename cpp11::result_of<typename R::Compute_hx_2(Point_2)>::type decltype(auto)
homogeneous(int i) const homogeneous(int i) const
{ {
CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -90,49 +90,49 @@ public:
swap(a.rep(), b.rep()); swap(a.rep(), b.rep());
} }
typename cpp11::result_of<typename R::Compute_x_3( Point_3)>::type decltype(auto)
x() const x() const
{ {
return typename R::Compute_x_3()(*this); return typename R::Compute_x_3()(*this);
} }
typename cpp11::result_of<typename R::Compute_y_3( Point_3)>::type decltype(auto)
y() const y() const
{ {
return typename R::Compute_y_3()(*this); return typename R::Compute_y_3()(*this);
} }
typename cpp11::result_of<typename R::Compute_z_3( Point_3)>::type decltype(auto)
z() const z() const
{ {
return typename R::Compute_z_3()(*this); return typename R::Compute_z_3()(*this);
} }
typename cpp11::result_of<typename R::Compute_hx_3( Point_3)>::type decltype(auto)
hx() const hx() const
{ {
return R().compute_hx_3_object()(*this); return R().compute_hx_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hy_3( Point_3)>::type decltype(auto)
hy() const hy() const
{ {
return R().compute_hy_3_object()(*this); return R().compute_hy_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hz_3( Point_3)>::type decltype(auto)
hz() const hz() const
{ {
return R().compute_hz_3_object()(*this); return R().compute_hz_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hw_3( Point_3)>::type decltype(auto)
hw() const hw() const
{ {
return R().compute_hw_3_object()(*this); return R().compute_hw_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_x_3( Point_3)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -151,7 +151,7 @@ public:
return hw(); return hw();
} }
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);

View File

@ -23,7 +23,6 @@
#include <CGAL/kernel_assertions.h> #include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -81,13 +80,13 @@ public:
: RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {} : RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {}
typename cpp11::result_of<typename R_::Construct_source_2( Ray_2)>::type decltype(auto)
source() const source() const
{ {
return R().construct_source_2_object()(*this); return R().construct_source_2_object()(*this);
} }
typename cpp11::result_of<typename R_::Construct_second_point_2( Ray_2)>::type decltype(auto)
second_point() const second_point() const
{ {
return R().construct_second_point_2_object()(*this); return R().construct_second_point_2_object()(*this);
@ -108,7 +107,7 @@ public:
construct_scaled_vector(construct_vector(source(), second_point()), i)); construct_scaled_vector(construct_vector(source(), second_point()), i));
} }
typename cpp11::result_of<typename R_::Construct_source_2( Ray_2 )>::type decltype(auto)
start() const start() const
{ {
return source(); return source();

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -99,25 +98,25 @@ public:
bool collinear_has_on(const Point_3 &p) const; bool collinear_has_on(const Point_3 &p) const;
*/ */
typename cpp11::result_of<typename R::Construct_point_on_3(Ray_3, FT)>::type decltype(auto)
point(const FT i) const point(const FT i) const
{ {
return R().construct_point_on_3_object()(*this, i); return R().construct_point_on_3_object()(*this, i);
} }
typename cpp11::result_of<typename R::Construct_source_3(Ray_3)>::type decltype(auto)
source() const source() const
{ {
return R().construct_source_3_object()(*this); return R().construct_source_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_second_point_3(Ray_3)>::type decltype(auto)
second_point() const second_point() const
{ {
return R().construct_second_point_3_object()(*this); return R().construct_second_point_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_source_3(Ray_3)>::type decltype(auto)
start() const start() const
{ {
return source(); return source();

View File

@ -23,7 +23,6 @@
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/kernel_config.h> #include <CGAL/kernel_config.h>
#include <CGAL/result_of.h>
namespace CGAL { namespace CGAL {
@ -70,45 +69,53 @@ public:
Segment_2(const Point_2 &sp, const Point_2 &ep) Segment_2(const Point_2 &sp, const Point_2 &ep)
: RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {} : RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {}
typename cpp11::result_of<typename R::Construct_source_2( Segment_2)>::type decltype(auto)
source() const source() const
{ {
return R_().construct_source_2_object()(*this); return R_().construct_source_2_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_target_2( Segment_2)>::type decltype(auto)
target() const target() const
{ {
return R_().construct_target_2_object()(*this); return R_().construct_target_2_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_source_2( Segment_2)>::type decltype(auto)
start() const start() const
{ {
return source(); return source();
} }
typename cpp11::result_of<typename R::Construct_target_2( Segment_2)>::type decltype(auto)
end() const end() const
{ {
return target(); return target();
} }
decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xy_2 less_xy;
return less_xy(source(), target()) ? source() : target();
}
typename cpp11::result_of<typename R_::Construct_min_vertex_2(Segment_2)>::type decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION() const; max BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xy_2 less_xy;
return less_xy(source(), target()) ? target() : source();
}
typename cpp11::result_of<typename R_::Construct_max_vertex_2( Segment_2)>::type decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const; vertex(int i) const
{ return (i%2 == 0) ? source() : target(); }
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type decltype(auto)
vertex(int i) const; point(int i) const
{ return vertex(i); }
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type decltype(auto)
point(int i) const; operator[](int i) const
{ return vertex(i); }
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type
operator[](int i) const;
bool is_horizontal() const; bool is_horizontal() const;
bool is_vertical() const; bool is_vertical() const;
@ -170,47 +177,6 @@ public:
} }
}; };
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_min_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
return less_xy(source(),target()) ? source() : target();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_max_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
return less_xy(source(),target()) ? target() : source();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();
}
template < class R_ >
inline
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::point(int i) const
{
return vertex(i);
}
template < class R_ >
inline
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::operator[](int i) const
{
return vertex(i);
}
template < class R_ > template < class R_ >
CGAL_KERNEL_INLINE CGAL_KERNEL_INLINE

View File

@ -68,44 +68,51 @@ public:
Segment_3(const Point_3& sp, const Point_3& ep) Segment_3(const Point_3& sp, const Point_3& ep)
: Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {} : Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {}
typename cpp11::result_of<typename R::Construct_source_3(Segment_3)>::type decltype(auto)
source() const source() const
{ {
return R_().construct_source_3_object()(*this); return R_().construct_source_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_target_3(Segment_3)>::type decltype(auto)
target() const target() const
{ {
return R_().construct_target_3_object()(*this); return R_().construct_target_3_object()(*this);
} }
typename cpp11::result_of<typename R::Construct_source_3(Segment_3)>::type decltype(auto)
start() const start() const
{ {
return source(); return source();
} }
typename cpp11::result_of<typename R::Construct_target_3(Segment_3)>::type decltype(auto)
end() const end() const
{ {
return target(); return target();
} }
typename cpp11::result_of<typename R_::Construct_min_vertex_3(Segment_3)>::type decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION () const; min BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(), target()) ? source() : target();
}
typename cpp11::result_of<typename R_::Construct_max_vertex_3(Segment_3)>::type decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const; max BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(), target()) ? target() : source();
}
typename cpp11::result_of<typename R_::Construct_vertex_3(Segment_3, int)>::type decltype(auto)
vertex(int i) const; vertex(int i) const
{ return (i%2 == 0) ? source() : target(); }
typename cpp11::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type decltype(auto)
point(int i) const point(int i) const
{ return vertex(i); } { return vertex(i); }
typename cpp11::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ return vertex(i); } { return vertex(i); }
@ -161,32 +168,6 @@ public:
}; };
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_min_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(),target()) ? source() : target();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_max_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(),target()) ? target() : source();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_vertex_3( Segment_3<R_>, int ) >::type
Segment_3<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();
}
template < class R > template < class R >
std::ostream & std::ostream &

View File

@ -86,7 +86,7 @@ public:
Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const; Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const;
typename cpp11::result_of<typename R::Construct_center_3( Sphere_3)>::type decltype(auto)
center() const center() const
{ {
return R().construct_center_3_object()(*this); return R().construct_center_3_object()(*this);

View File

@ -70,13 +70,13 @@ public:
t.transform(this->vertex(3))); t.transform(this->vertex(3)));
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type decltype(auto)
vertex(int i) const vertex(int i) const
{ {
return R().construct_vertex_3_object()(*this,i); return R().construct_vertex_3_object()(*this,i);
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return vertex(i); return vertex(i);
@ -128,7 +128,7 @@ public:
return R().has_on_unbounded_side_3_object()(*this, p); return R().has_on_unbounded_side_3_object()(*this, p);
} }
typename cpp11::result_of<typename R::Compute_volume_3( Tetrahedron_3)>::type decltype(auto)
volume() const volume() const
{ {
return R().compute_volume_3_object()(*this); return R().compute_volume_3_object()(*this);

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -101,13 +100,13 @@ public:
return !(*this == t); return !(*this == t);
} }
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type decltype(auto)
vertex(int i) const vertex(int i) const
{ {
return R().construct_vertex_2_object()(*this,i); return R().construct_vertex_2_object()(*this,i);
} }
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return vertex(i); return vertex(i);

View File

@ -82,13 +82,13 @@ public:
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Triangle_3, int )>::type decltype(auto)
vertex(int i) const vertex(int i) const
{ {
return R().construct_vertex_3_object()(*this, i); return R().construct_vertex_3_object()(*this, i);
} }
typename cpp11::result_of<typename R::Construct_vertex_3( Triangle_3, int )>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return vertex(i); return vertex(i);

View File

@ -25,7 +25,6 @@
#include <CGAL/kernel_assertions.h> #include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h> #include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -103,26 +102,26 @@ public:
} }
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type decltype(auto)
x() const x() const
{ {
return R().compute_x_2_object()(*this); return R().compute_x_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_y_2(Vector_2)>::type decltype(auto)
y() const y() const
{ {
return R().compute_y_2_object()(*this); return R().compute_y_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_y_2(Vector_2)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) ); CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y(); return (i==0) ? x() : y();
} }
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);
@ -138,26 +137,26 @@ public:
return typename R::Construct_cartesian_const_iterator_2()(*this,2); return typename R::Construct_cartesian_const_iterator_2()(*this,2);
} }
typename cpp11::result_of<typename R::Compute_hx_2(Vector_2)>::type decltype(auto)
hx() const hx() const
{ {
return R().compute_hx_2_object()(*this); return R().compute_hx_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hy_2(Vector_2)>::type decltype(auto)
hy() const hy() const
{ {
return R().compute_hy_2_object()(*this); return R().compute_hy_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hw_2(Vector_2)>::type decltype(auto)
hw() const hw() const
{ {
return R().compute_hw_2_object()(*this); return R().compute_hw_2_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hx_2(Vector_2)>::type decltype(auto)
homogeneous(int i) const homogeneous(int i) const
{ {
CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -25,7 +25,6 @@
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h> #include <CGAL/IO/io.h>
namespace CGAL { namespace CGAL {
@ -173,49 +172,49 @@ public:
return *this; return *this;
} }
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type decltype(auto)
x() const x() const
{ {
return R().compute_x_3_object()(*this); return R().compute_x_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_y_3(Vector_3)>::type decltype(auto)
y() const y() const
{ {
return R().compute_y_3_object()(*this); return R().compute_y_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_z_3(Vector_3)>::type decltype(auto)
z() const z() const
{ {
return R().compute_z_3_object()(*this); return R().compute_z_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hx_3(Vector_3)>::type decltype(auto)
hx() const hx() const
{ {
return R().compute_hx_3_object()(*this); return R().compute_hx_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hy_3(Vector_3)>::type decltype(auto)
hy() const hy() const
{ {
return R().compute_hy_3_object()(*this); return R().compute_hy_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hz_3(Vector_3)>::type decltype(auto)
hz() const hz() const
{ {
return R().compute_hz_3_object()(*this); return R().compute_hz_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_hw_3(Vector_3)>::type decltype(auto)
hw() const hw() const
{ {
return R().compute_hw_3_object()(*this); return R().compute_hw_3_object()(*this);
} }
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -224,7 +223,7 @@ public:
return z(); return z();
} }
typename cpp11::result_of<typename R::Compute_hw_3(Vector_3)>::type decltype(auto)
homogeneous(int i) const homogeneous(int i) const
{ {
CGAL_kernel_precondition( (i >= 0) || (i <= 3) ); CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
@ -239,7 +238,7 @@ public:
return 3; return 3;
} }
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);
@ -255,7 +254,7 @@ public:
return typename R::Construct_cartesian_const_iterator_3()(*this,3); return typename R::Construct_cartesian_const_iterator_3()(*this,3);
} }
typename cpp11::result_of<typename R::Compute_squared_length_3(Vector_3)>::type decltype(auto)
squared_length() const squared_length() const
{ {
return R().compute_squared_length_3_object()(*this); return R().compute_squared_length_3_object()(*this);

View File

@ -24,7 +24,6 @@
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h> #include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/Point_2.h> #include <CGAL/Point_2.h>
namespace CGAL { namespace CGAL {
@ -83,50 +82,50 @@ public:
: Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y)) : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y))
{} {}
typename cpp11::result_of<typename R::Construct_point_2( Weighted_point_2)>::type decltype(auto)
point() const point() const
{ {
return typename R::Construct_point_2()(*this); return typename R::Construct_point_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_weight_2( Weighted_point_2)>::type decltype(auto)
weight() const weight() const
{ {
return typename R::Compute_weight_2()(*this); return typename R::Compute_weight_2()(*this);
} }
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type decltype(auto)
x() const x() const
{ {
return typename R::Compute_x_2()(point()); return typename R::Compute_x_2()(point());
} }
typename cpp11::result_of<typename R::Compute_y_2( Point_2)>::type decltype(auto)
y() const y() const
{ {
return typename R::Compute_y_2()(point()); return typename R::Compute_y_2()(point());
} }
typename cpp11::result_of<typename R::Compute_hx_2( Point_2)>::type decltype(auto)
hx() const hx() const
{ {
return R().compute_hx_2_object()(point()); return R().compute_hx_2_object()(point());
} }
typename cpp11::result_of<typename R::Compute_hy_2( Point_2)>::type decltype(auto)
hy() const hy() const
{ {
return R().compute_hy_2_object()(point()); return R().compute_hy_2_object()(point());
} }
typename cpp11::result_of<typename R::Compute_hw_2( Point_2)>::type decltype(auto)
hw() const hw() const
{ {
return R().compute_hw_2_object()(point()); return R().compute_hw_2_object()(point());
} }
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) ); CGAL_kernel_precondition( (i == 0) || (i == 1) );
@ -143,7 +142,7 @@ public:
return hw(); return hw();
} }
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);

View File

@ -84,62 +84,62 @@ public:
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z)) : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z))
{} {}
typename cpp11::result_of<typename R::Construct_point_3(Weighted_point_3)>::type decltype(auto)
point() const point() const
{ {
return typename R::Construct_point_3()(*this); return typename R::Construct_point_3()(*this);
} }
typename cpp11::result_of<typename R::Compute_weight_3(Weighted_point_3)>::type decltype(auto)
weight() const weight() const
{ {
return typename R::Compute_weight_3()(*this); return typename R::Compute_weight_3()(*this);
} }
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type decltype(auto)
x() const x() const
{ {
return typename R::Compute_x_3()(point()); return typename R::Compute_x_3()(point());
} }
typename cpp11::result_of<typename R::Compute_y_3(Point_3)>::type decltype(auto)
y() const y() const
{ {
return typename R::Compute_y_3()(point()); return typename R::Compute_y_3()(point());
} }
typename cpp11::result_of<typename R::Compute_z_3(Point_3)>::type decltype(auto)
z() const z() const
{ {
return typename R::Compute_z_3()(point()); return typename R::Compute_z_3()(point());
} }
typename cpp11::result_of<typename R::Compute_hx_3(Point_3)>::type decltype(auto)
hx() const hx() const
{ {
return R().compute_hx_3_object()(point()); return R().compute_hx_3_object()(point());
} }
typename cpp11::result_of<typename R::Compute_hy_3(Point_3)>::type decltype(auto)
hy() const hy() const
{ {
return R().compute_hy_3_object()(point()); return R().compute_hy_3_object()(point());
} }
typename cpp11::result_of<typename R::Compute_hz_3(Point_3)>::type decltype(auto)
hz() const hz() const
{ {
return R().compute_hz_3_object()(point()); return R().compute_hz_3_object()(point());
} }
typename cpp11::result_of<typename R::Compute_hw_3(Point_3)>::type decltype(auto)
hw() const hw() const
{ {
return R().compute_hw_3_object()(point()); return R().compute_hw_3_object()(point());
} }
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type decltype(auto)
cartesian(int i) const cartesian(int i) const
{ {
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -158,7 +158,7 @@ public:
return hw(); return hw();
} }
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type decltype(auto)
operator[](int i) const operator[](int i) const
{ {
return cartesian(i); return cartesian(i);

View File

@ -23,11 +23,6 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
// This cannot be disabled for now until we have a clear idea which
// compilers implement N3276.
#include <CGAL/result_of.h>
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/tags.h> #include <CGAL/tags.h>
#include <CGAL/number_type_basic.h> #include <CGAL/number_type_basic.h>

View File

@ -327,8 +327,7 @@ public:
//compute intersection points in projected plane //compute intersection points in projected plane
//We know that none of the segment is degenerate //We know that none of the segment is degenerate
typename CGAL::cpp11::result_of<typename R::Intersect_2(Segment_2, Segment_2)>::type auto o = intersection(s1_2,s2_2);
o = intersection(s1_2,s2_2);
if(! o){ if(! o){
return boost::none; return boost::none;
} }

View File

@ -17,8 +17,7 @@ template <class K1, class K2, class T1, class T2>
void test_2d(const T1& t1, const T2& t2) void test_2d(const T1& t1, const T2& t2)
{ {
CGAL::Cartesian_converter<K1,K2> convert; CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_2(T1, T2)>::type res1 = const auto res1 = CGAL::intersection(t1, t2);
CGAL::intersection(t1, t2);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
} }
@ -26,8 +25,7 @@ template <class K1, class K2, class T1, class T2>
void test_3d(const T1& t1, const T2& t2) void test_3d(const T1& t1, const T2& t2)
{ {
CGAL::Cartesian_converter<K1,K2> convert; CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_3(T1, T2)>::type res1 = const auto res1 = CGAL::intersection(t1, t2);
CGAL::intersection(t1, t2);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
} }
@ -112,7 +110,6 @@ void test_linear_intersections()
test_3d<K1,K2>(triangle_3, triangle_3); test_3d<K1,K2>(triangle_3, triangle_3);
CGAL::Cartesian_converter<K1,K2> convert; CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_3(Plane_3, Plane_3, Plane_3)>::type res1 = const auto res1 = CGAL::intersection(plane_3, plane_3, plane_3);
CGAL::intersection(plane_3, plane_3, plane_3);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
} }

View File

@ -34,14 +34,16 @@ The same functionality is also available through the functor `Kernel::Intersect_
The following table gives the possible values for `Type1` and `Type2`. The following table gives the possible values for `Type1` and `Type2`.
The return type can be obtained through `cpp11::result_of<Kernel::Intersect_d(A, B)>::%type`. The return type of intersecting two objects of the types `Type1` and `Type2` can be
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER"> <DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1"> <TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH> <TR>
<TH> Type1 </TH>
<TH> Type2 </TH> <TH> Type2 </TH>
<TH> `T...` </TH> <TH> `T...` </TH>
</TR> </TR>
@ -143,13 +145,8 @@ struct Intersection_visitor {
template <class R> template <class R>
void foo(Segment_d<R> seg, Line_d<R> lin) void foo(Segment_d<R> seg, Line_d<R> lin)
{ {
// with C++11 support // use auto
// auto result = intersection(seg, lin); auto result = intersection(seg, lin);
// without C++11 support
typename cpp11::result_of<R::Intersect_d(Segment_d<R>, Line_d<R>)>::type
result = intersection(seg, lin);
if(result) { boost::apply_visitor(Intersection_visitor<R>(), *result); } if(result) { boost::apply_visitor(Intersection_visitor<R>(), *result); }
else { // no intersection else { // no intersection
} }
@ -160,10 +157,10 @@ void foo(Segment_d<R> seg, Line_d<R> lin)
\sa `Kernel_d::Intersect_d` \sa `Kernel_d::Intersect_d`
\sa <a HREF="https://www.boost.org/doc/libs/release/libs/optional/index.html">`boost::optional`</a> \sa <a HREF="https://www.boost.org/doc/libs/release/libs/optional/index.html">`boost::optional`</a>
\sa <a HREF="https://www.boost.org/doc/html/variant.html">`boost::variant`</a> \sa <a HREF="https://www.boost.org/doc/html/variant.html">`boost::variant`</a>
\sa `cpp11::result_of`
*/ */
cpp11::result_of<R::Intersect_d(Type1<R>, Type2<R>)>::type intersection(Type1<R> f1, Type2<R> f2); decltype(auto)
intersection(Type1<R> f1, Type2<R> f2);
} /* namespace CGAL */ } /* namespace CGAL */

View File

@ -23,7 +23,7 @@ For a list of the possible return types, see `CGAL::intersection()`.
\pre `p` and `q` have the same dimension. \pre `p` and `q` have the same dimension.
*/ */
template <class Type1, class Type2> template <class Type1, class Type2>
cpp11::result_of<Kernel::Intersect_d(Type1, Type2)>::type decltype(auto)
operator()(const Type1& p, const Type2& q); operator()(const Type1& p, const Type2& q);
/// @} /// @}

View File

@ -480,17 +480,14 @@ that are part of flats (`R::Segment_d`, `R::Ray_d`,
returns a `boost::optional< boost::variant< T... > >` returns a `boost::optional< boost::variant< T... > >`
where `T...` is a list of all possible resulting geometric objects. where `T...` is a list of all possible resulting geometric objects.
The exact result type of an intersection can be determined by using The return type of intersecting two objects of the types `Type1` and `Type2` can be
`cpp11::result_of<Kernel::Intersect_d(Type1, Type2)>::%type` specified through the placeholder type specifier `auto`.
where `Type1` and `Type2` are the types of the objects
used in the intersection computation.
\subsubsection Kernel_dExample Example \subsubsection Kernel_dExample Example
In the following example, the object type is used as a return value for In the following example, the `auto` is used for the intersection computation,
the intersection computation, as there are as there are possibly different return values.
possibly different return values.
\code{.cpp} \code{.cpp}
typedef Cartesian_d<double> K; typedef Cartesian_d<double> K;
@ -500,9 +497,9 @@ typedef Segment_d<K> Segment;
Segment s1, s2; Segment s1, s2;
std::cin >> s1 >> s2; std::cin >> s1 >> s2;
cpp11::result_of<K::Intersect_d(Segment, Segment)>::type // use auto
v = intersection(s1, s2); auto v = intersection(s1, s2);
if(v) { if (v) {
// not empty // not empty
if (const Point *p = boost::get<Point>(&*v) ) { if (const Point *p = boost::get<Point>(&*v) ) {
// do something with *p // do something with *p

View File

@ -25,7 +25,7 @@ namespace Intersections {
namespace internal { namespace internal {
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Line_d)>::type decltype(auto)
intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R&) intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R&)
{ {
typedef typename R::Line_d_Line_d_pair ll_pair; typedef typename R::Line_d_Line_d_pair ll_pair;
@ -46,7 +46,7 @@ intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Ray_d)>::type decltype(auto)
intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&)
{ {
typedef typename R::Ray_d_Ray_d_pair ll_pair; typedef typename R::Ray_d_Ray_d_pair ll_pair;
@ -75,7 +75,7 @@ intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&)
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Segment_d)>::type decltype(auto)
intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, const R&) intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, const R&)
{ {
typedef typename R::Segment_d_Segment_d_pair ll_pair; typedef typename R::Segment_d_Segment_d_pair ll_pair;
@ -99,7 +99,7 @@ intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, c
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Ray_d)>::type decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&)
{ {
typedef typename R::Line_d_Ray_d_pair lr_pair; typedef typename R::Line_d_Ray_d_pair lr_pair;
@ -121,12 +121,12 @@ intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&)
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Line_d)>::type decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k) intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k)
{ return intersection(l,r,k); } { return intersection(l,r,k); }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Segment_d)>::type decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R&) intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R&)
{ {
typedef typename R::Ray_d_Segment_d_pair rs_pair; typedef typename R::Ray_d_Segment_d_pair rs_pair;
@ -150,12 +150,12 @@ intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Ray_d)>::type decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k) intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k)
{ return intersection(r,s, k); } { return intersection(r,s, k); }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Segment_d)>::type decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const R&) intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const R&)
{ {
typedef typename R::Line_d_Segment_d_pair rs_pair; typedef typename R::Line_d_Segment_d_pair rs_pair;
@ -179,12 +179,12 @@ intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Line_d)>::type decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r) intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r)
{ return intersection(l,s,r); } { return intersection(l,s,r); }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Hyperplane_d)>::type decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, const R&) intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, const R&)
{ {
typedef typename R::Line_d_Hyperplane_d_pair lh_pair; typedef typename R::Line_d_Hyperplane_d_pair lh_pair;
@ -205,12 +205,12 @@ intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, con
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Line_d)>::type decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r) intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r)
{ return intersection(l,h,r); } { return intersection(l,h,r); }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Hyperplane_d)>::type decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, const R&) intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, const R&)
{ {
typedef typename R::Ray_d_Hyperplane_d_pair rh_pair; typedef typename R::Ray_d_Hyperplane_d_pair rh_pair;
@ -231,12 +231,12 @@ intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, cons
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Ray_d)>::type decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k) intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k)
{ return intersection(r,h,k); } { return intersection(r,h,k); }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Hyperplane_d)>::type decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, const R&) intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, const R&)
{ {
typedef typename R::Segment_d_Hyperplane_d_pair sh_pair; typedef typename R::Segment_d_Hyperplane_d_pair sh_pair;
@ -258,7 +258,7 @@ intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h,
} }
template <class R> template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Segment_d)>::type decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r) intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r)
{ return intersection(s,h,r); } { return intersection(s,h,r); }

View File

@ -145,7 +145,6 @@
#include <boost/type_traits/remove_reference.hpp> #include <boost/type_traits/remove_reference.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/variant.hpp> #include <boost/variant.hpp>
#include <boost/version.hpp> #include <boost/version.hpp>

View File

@ -312,11 +312,11 @@ public:
/*! /*!
A constructor object that must provide the function operators: A constructor object that must provide the function operators:
`CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Plane_3)>::%type operator()(Segment_3 s, Plane_3 p)` `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Plane_3 p)`
`CGAL::cpp11::result_of< Kernel::Intersect_3(Ray_3, Iso_cuboid_3)>::%type operator()(Ray_3 r, Iso_cuboid i)` `boost::optional< boost::variant< T... > > operator()(Ray_3 r, Iso_cuboid i)`
`CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Iso_cuboid_3)>::%type operator()(Segment_3 s, Iso_cuboid i)` `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Iso_cuboid i)`
which returns the intersection region of two geometrical objects. which returns the intersection region of two geometrical objects.
*/ */

View File

@ -31,7 +31,6 @@
#include <CGAL/tuple.h> #include <CGAL/tuple.h>
#include <CGAL/Origin.h> #include <CGAL/Origin.h>
#include <CGAL/result_of.h>
#include <functional> #include <functional>
#include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h> #include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h>
@ -590,9 +589,7 @@ public:
template<typename Query> template<typename Query>
Surface_patch clip_to_segment(const Query& query) const Surface_patch clip_to_segment(const Query& query) const
{ {
typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type const auto clipped = CGAL::intersection(query, r_domain_.bbox_);
clipped = CGAL::intersection(query, r_domain_.bbox_);
if(clipped) if(clipped)
if(const Segment_3* s = boost::get<Segment_3>(&*clipped)) if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
return this->operator()(*s); return this->operator()(*s);
@ -720,9 +717,7 @@ public:
template<typename Query> template<typename Query>
Intersection clip_to_segment(const Query& query) const Intersection clip_to_segment(const Query& query) const
{ {
typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type const auto clipped = CGAL::intersection(query, r_domain_.bbox_);
clipped = CGAL::intersection(query, r_domain_.bbox_);
if(clipped) if(clipped)
if(const Segment_3* s = boost::get<Segment_3>(&*clipped)) if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
return this->operator()(*s); return this->operator()(*s);

View File

@ -261,15 +261,16 @@ lp_intersection(const typename K::Point_3& p, const typename K::Point_3& q,
// returns a point or the empty Object. In case of degeneracy, the empty // returns a point or the empty Object. In case of degeneracy, the empty
// Object is returned as well. // Object is returned as well.
template <class K> template <class K>
typename cpp11::result_of< decltype(auto)
typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3)>::type
ts_intersection(const typename K::Triangle_3 &t, ts_intersection(const typename K::Triangle_3 &t,
const typename K::Segment_3 &s, const typename K::Segment_3 &s,
const K & k) const K & k)
{ {
typedef typename cpp11::result_of< // typedef decltype(
typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3) // std::declval<typename K::Intersect_3>()(
>::type result_type; // std::declval<typename K::Segment_3>(),
// std::declval<typename K::Triangle_3>())) result_type;
typedef decltype(typename K::Intersect_3()(s, t)) result_type;
CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") + CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") +
std::string(CGAL_PRETTY_FUNCTION), tmp); std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -399,8 +400,7 @@ ts_intersection(const typename K::Triangle_3 &t,
template <class K> template <class K>
typename cpp11::result_of< decltype(auto)
typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3)>::type
tr_intersection(const typename K::Triangle_3 &t, tr_intersection(const typename K::Triangle_3 &t,
const typename K::Ray_3 &r, const typename K::Ray_3 &r,
const K& k) const K& k)
@ -410,9 +410,11 @@ tr_intersection(const typename K::Triangle_3 &t,
CGAL_kernel_precondition( ! k.is_degenerate_3_object()(t) ) ; CGAL_kernel_precondition( ! k.is_degenerate_3_object()(t) ) ;
CGAL_kernel_precondition( ! k.is_degenerate_3_object()(r) ) ; CGAL_kernel_precondition( ! k.is_degenerate_3_object()(r) ) ;
typedef typename cpp11::result_of< // typedef decltype(
typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3) // std::declval<typename K::Intersect_3>()(
>::type result_type; // std::declval<typename K::Ray_3>(),
// std::declval<typename K::Triangle_3>())) result_type;
typedef decltype(typename K::Intersect_3()(r, t)) result_type;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
@ -471,20 +473,12 @@ public:
typedef typename K_::Segment_3 Segment_3; typedef typename K_::Segment_3 Segment_3;
typedef typename K_::Ray_3 Ray_3; typedef typename K_::Ray_3 Ray_3;
template <typename>
struct result;
template <typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename cpp11::result_of<typename K_::Intersect_3(A, B)>::type type;
};
typedef Exact_predicates_exact_constructions_kernel EK; typedef Exact_predicates_exact_constructions_kernel EK;
typedef Cartesian_converter<typename K_::Kernel, EK> To_exact; typedef Cartesian_converter<typename K_::Kernel, EK> To_exact;
typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact; typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact;
template<class T1, class T2> template<class T1, class T2>
typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type decltype(auto)
operator() (const T1& t, const T2& s) const operator() (const T1& t, const T2& s) const
{ {
// Switch to exact // Switch to exact
@ -493,28 +487,32 @@ public:
EK::Intersect_3 exact_intersection = EK().intersect_3_object(); EK::Intersect_3 exact_intersection = EK().intersect_3_object();
// Cartesian converters have an undocumented, optional< variant > operator // Cartesian converters have an undocumented, optional< variant > operator
return typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type // typedef decltype(
(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); // std::declval<typename K_::Intersect_3>()(
// std::declval<T1>(), std::declval<T2>())) result_type;
typedef decltype(typename K_::Intersect_3()(t, s)) result_type;
return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
} }
typename cpp11::result_of<typename K_::Intersect_3(Segment_3, Triangle_3)>::type decltype(auto)
operator()(const Segment_3& s, const Triangle_3& t) const operator()(const Segment_3& s, const Triangle_3& t) const
{ {
return ts_intersection(t, s, K_()); return ts_intersection(t, s, K_());
} }
typename cpp11::result_of<typename K_::Intersect_3(Segment_3, Triangle_3)>::type decltype(auto)
operator()(const Triangle_3& t, const Segment_3& s) const operator()(const Triangle_3& t, const Segment_3& s) const
{ {
return ts_intersection(t, s, K_()); return ts_intersection(t, s, K_());
} }
typename cpp11::result_of<typename K_::Intersect_3(Ray_3, Triangle_3)>::type decltype(auto)
operator()(const Ray_3& r, const Triangle_3& t) const { operator()(const Ray_3& r, const Triangle_3& t) const {
return tr_intersection(t, r, K_()); return tr_intersection(t, r, K_());
} }
typename cpp11::result_of<typename K_::Intersect_3(Ray_3, Triangle_3)>::type decltype(auto)
operator()(const Triangle_3& t, const Ray_3& r) const operator()(const Triangle_3& t, const Ray_3& r) const
{ {
return tr_intersection(t, r, K_()); return tr_intersection(t, r, K_());
@ -531,20 +529,12 @@ public:
typedef typename K_::Triangle_3 Triangle_3; typedef typename K_::Triangle_3 Triangle_3;
typedef typename K_::Segment_3 Segment_3; typedef typename K_::Segment_3 Segment_3;
template <typename>
struct result;
template <typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename cpp11::result_of<typename K_::Intersect_3(A, B)>::type type;
};
typedef Exact_predicates_exact_constructions_kernel EK; typedef Exact_predicates_exact_constructions_kernel EK;
typedef Cartesian_converter<typename K_::Kernel, EK> To_exact; typedef Cartesian_converter<typename K_::Kernel, EK> To_exact;
typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact; typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact;
template<class T1, class T2> template<class T1, class T2>
typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type decltype(auto)
operator() (const T1& t, const T2& s) const operator() (const T1& t, const T2& s) const
{ {
// Switch to exact // Switch to exact
@ -553,8 +543,12 @@ public:
EK::Intersect_3 exact_intersection = EK().intersect_3_object(); EK::Intersect_3 exact_intersection = EK().intersect_3_object();
// Cartesian converters have an undocumented, optional< variant > operator // Cartesian converters have an undocumented, optional< variant > operator
return typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type // typedef decltype(
(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); // std::declval<typename K_::Intersect_3>()(
// std::declval<T1>(), std::declval<T2>())) result_type;
typedef decltype(typename K_::Intersect_3()(t, s)) result_type;
return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
} }
}; };

View File

@ -385,8 +385,6 @@ struct Sizing_field_with_aabb_tree
//Compute distance to the curve on which p lies //Compute distance to the curve on which p lies
typedef typename GeomTraits::Segment_3 Segment_3; typedef typename GeomTraits::Segment_3 Segment_3;
typedef typename GeomTraits::Plane_3 Plane_3; typedef typename GeomTraits::Plane_3 Plane_3;
typedef typename CGAL::cpp11::result_of<
typename GeomTraits::Intersect_3(Segment_3, Plane_3)>::type Intersection_result;
const typename Input_curves_AABB_tree_::Point_and_primitive_id& ppid const typename Input_curves_AABB_tree_::Point_and_primitive_id& ppid
= domain.curves_aabb_tree().closest_point_and_primitive(p); = domain.curves_aabb_tree().closest_point_and_primitive(p);
@ -417,8 +415,7 @@ struct Sizing_field_with_aabb_tree
if (curve_id != prim.id().first->first) if (curve_id != prim.id().first->first)
continue;//don't deal with the same curves as what is done above continue;//don't deal with the same curves as what is done above
Intersection_result int_res const auto int_res = CGAL::intersection(prim.datum(), curr_ortho_plane);
= CGAL::intersection(prim.datum(), curr_ortho_plane);
if (int_res) if (int_res)
{ {
if (const Point_3* pp = boost::get<Point_3>(&*int_res)) if (const Point_3* pp = boost::get<Point_3>(&*int_res))

View File

@ -439,9 +439,7 @@ public:
if(r_domain_.query_is_cached(q)) if(r_domain_.query_is_cached(q))
{ {
const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id(); const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id();
typename cpp11::result_of< const auto o = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o
= IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
intersection = o ? intersection = o ?
Intersection_and_primitive_id(*o, primitive_id) : Intersection_and_primitive_id(*o, primitive_id) :
AABB_intersection(); AABB_intersection();

View File

@ -63,7 +63,7 @@ public:
typedef C2E To_exact_converter; typedef C2E To_exact_converter;
typedef C2A To_approximate_converter; typedef C2A To_approximate_converter;
// FIXME: should use result_of, see emails by Nico // FIXME: should use result_of or decltype(auto), see emails by Nico
typedef typename EP::result_type result_type; typedef typename EP::result_type result_type;
// AP::result_type must be convertible to EP::result_type. // AP::result_type must be convertible to EP::result_type.

View File

@ -134,7 +134,7 @@ typename typeset_intersection<typename K1::Object_list, typename K2::Object_list
KernelD_converter(){} KernelD_converter(){}
KernelD_converter(K1 const&a,K2 const&b):Store_kernel<K1>(a),Store_kernel2<K2>(b){} KernelD_converter(K1 const&a,K2 const&b):Store_kernel<K1>(a),Store_kernel2<K2>(b){}
// For boost::result_of, used in transforming_iterator // For the (not anymore used in CGAL) boost result of, used in transforming_iterator
template<class T,int i=is_iterator<T>::value?42:0> struct result:Base::template result<T>{}; template<class T,int i=is_iterator<T>::value?42:0> struct result:Base::template result<T>{};
template<class T> struct result<Final_(T),42> { template<class T> struct result<Final_(T),42> {
typedef transforming_iterator<Final_,T> type; typedef transforming_iterator<Final_,T> type;

View File

@ -127,15 +127,15 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
typedef typename Get_functor<Base, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI; typedef typename Get_functor<Base, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CPI;
typedef typename Get_functor<Base, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI; typedef typename Get_functor<Base, Construct_ttag<Vector_cartesian_const_iterator_tag> >::type CVI;
// FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d.
//typedef typename CGAL::decay<typename boost::result_of<CPI(Point_d,CGAL::Begin_tag)>::type>::type result_type; // typedef typename CGAL::decay<typename boost::result_of<CPI(Point_d,CGAL::Begin_tag)>::type>::type result_type;
//typedef typename CGAL::decay<typename CPI::result_type>::type result_type; // typedef typename CGAL::decay<typename CPI::result_type>::type result_type;
//typedef decltype(std::declval<CPI>()(std::declval<Point_d>(),Begin_tag{})) result_type; // typedef decltype(std::declval<CPI>()(std::declval<Point_d>(),Begin_tag{})) result_type;
// HACK // HACK
typedef typename Base::Point_cartesian_const_iterator result_type; typedef typename Base::Point_cartesian_const_iterator result_type;
// Kernel_d requires a common iterator type for points and vectors // Kernel_d requires a common iterator type for points and vectors
// TODO: provide this mixed functor in preKernel? // TODO: provide this mixed functor in preKernel?
//CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename boost::result_of<CVI(Vector_d,CGAL::Begin_tag)>::type>::type, result_type>::value)); // CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename boost::result_of<CVI(Vector_d,CGAL::Begin_tag)>::type>::type, result_type>::value));
//CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename CVI::result_type>::type, result_type>::value)); // CGAL_static_assertion((boost::is_same<typename CGAL::decay<typename CVI::result_type>::type, result_type>::value));
template <class Tag_> template <class Tag_>
auto operator()(Point_d const&p, Tag_ t)const{ auto operator()(Point_d const&p, Tag_ t)const{
return CPI(this->kernel())(p,t); return CPI(this->kernel())(p,t);

View File

@ -49,7 +49,7 @@ public:
typedef Dimension_tag<0> Feature_dimension; typedef Dimension_tag<0> Feature_dimension;
typedef typename Get_type<Kbase, Point_tag>::type Rep; typedef typename Get_type<Kbase, Point_tag>::type Rep;
//typedef typename CGAL::decay<typename boost::result_of<CPI(Rep,Begin_tag)>::type>::type Cartesian_const_iterator; // typedef typename CGAL::decay<typename boost::result_of<CPI(Rep,Begin_tag)>::type>::type Cartesian_const_iterator;
const Rep& rep() const noexcept const Rep& rep() const noexcept
{ {

View File

@ -22,7 +22,6 @@
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#include <CGAL/Kernel/Return_base_tag.h> #include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Dimension.h> #include <CGAL/Dimension.h>
#include <boost/utility/result_of.hpp>
namespace CGAL { namespace CGAL {
namespace Wrap { namespace Wrap {

View File

@ -787,8 +787,7 @@ public:
pt, geom_traits().construct_vector_2_object()(pt, ps)); pt, geom_traits().construct_vector_2_object()(pt, ps));
boost::optional<FT> Dqt; boost::optional<FT> Dqt;
typename CGAL::cpp11::result_of<typename Traits_::Intersect_2(Line, Line)>::type const auto result = intersection(lab, lts);
result = intersection(lab, lts);
if (result) if (result)
{ {
const Point* iq = boost::get<Point>(&(*result)); const Point* iq = boost::get<Point>(&(*result));

View File

@ -497,7 +497,7 @@ public:
// Spatial sorting can only be applied to bare points, so we need an adaptor // Spatial sorting can only be applied to bare points, so we need an adaptor
typedef typename Geom_traits::Construct_point_3 Construct_point_3; typedef typename Geom_traits::Construct_point_3 Construct_point_3;
typedef typename boost::result_of<const Construct_point_3(const Weighted_point&)>::type Ret; typedef decltype(std::declval<const Construct_point_3>()(std::declval<const Weighted_point&>())) Ret;
typedef boost::function_property_map<Construct_point_3, Weighted_point, Ret> fpmap; typedef boost::function_property_map<Construct_point_3, Weighted_point, Ret> fpmap;
typedef CGAL::Spatial_sort_traits_adapter_3<Geom_traits, fpmap> Search_traits_3; typedef CGAL::Spatial_sort_traits_adapter_3<Geom_traits, fpmap> Search_traits_3;

View File

@ -47,7 +47,6 @@
#include <boost/random/uniform_smallint.hpp> #include <boost/random/uniform_smallint.hpp>
#include <boost/random/variate_generator.hpp> #include <boost/random/variate_generator.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <iostream> #include <iostream>
@ -650,7 +649,7 @@ public:
// but point() -like functions have return type Point // but point() -like functions have return type Point
template<typename P> // can be Point or Point_3 template<typename P> // can be Point or Point_3
typename boost::result_of<const typename GT::Construct_point_3(const P&)>::type decltype(auto)
construct_point(const P& p) const { construct_point(const P& p) const {
return geom_traits().construct_point_3_object()(p); return geom_traits().construct_point_3_object()(p);
} }

View File

@ -800,9 +800,7 @@ private:
double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector())); double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector()));
double angle_B = CGAL_PI - angle_A; double angle_B = CGAL_PI - angle_A;
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type const auto result = CGAL::intersection(plane1, plane2);
result = CGAL::intersection(plane1, plane2);
if (!result) if (!result)
{ {
#ifdef CGAL_PSP3_VERBOSE #ifdef CGAL_PSP3_VERBOSE
@ -1029,8 +1027,7 @@ private:
pts2.push_back (m_points[inde]); pts2.push_back (m_points[inde]);
} }
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type auto result = CGAL::intersection (plane1, ortho);
result = CGAL::intersection (plane1, ortho);
if (result) if (result)
{ {
if (const Line* l = boost::get<Line>(&*result)) if (const Line* l = boost::get<Line>(&*result))
@ -1194,16 +1191,12 @@ private:
const Plane& plane2 = m_planes[m_corners[i].planes[1]]; const Plane& plane2 = m_planes[m_corners[i].planes[1]];
const Plane& plane3 = m_planes[m_corners[i].planes[2]]; const Plane& plane3 = m_planes[m_corners[i].planes[2]];
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type const auto result = CGAL::intersection(plane1, plane2);
result = CGAL::intersection(plane1, plane2);
if (result) if (result)
{ {
if (const Line* l = boost::get<Line>(&*result)) if (const Line* l = boost::get<Line>(&*result))
{ {
typename cpp11::result_of<typename Kernel::Intersect_3(Line, Plane)>::type const auto result2 = CGAL::intersection(*l, plane3);
result2 = CGAL::intersection(*l, plane3);
if (result2) if (result2)
{ {
if (const Point* p = boost::get<Point>(&*result2)) if (const Point* p = boost::get<Point>(&*result2))

View File

@ -263,9 +263,7 @@ public:
p3(to_exact( get(vpm, source(h3,tm)) ), p3(to_exact( get(vpm, source(h3,tm)) ),
to_exact( get(vpm, target(h3,tm)) ), to_exact( get(vpm, target(h3,tm)) ),
to_exact( get(vpm, target(next(h3,tm),tm)))); to_exact( get(vpm, target(next(h3,tm),tm))));
typename cpp11::result_of< const auto inter_res = exact_intersection(p1, p2, p3);
Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3)
>::type inter_res = exact_intersection(p1, p2, p3);
CGAL_assertion(inter_res != boost::none); CGAL_assertion(inter_res != boost::none);
const Exact_kernel::Point_3* pt = const Exact_kernel::Point_3* pt =
@ -389,9 +387,7 @@ public:
p3(get(vpm, source(h3,tm)), p3(get(vpm, source(h3,tm)),
get(vpm, target(h3,tm)), get(vpm, target(h3,tm)),
get(vpm, target(next(h3,tm),tm))); get(vpm, target(next(h3,tm),tm)));
typename cpp11::result_of< const auto inter_res = intersection(p1, p2, p3);
typename Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3)
>::type inter_res = intersection(p1, p2, p3);
CGAL_assertion(inter_res != boost::none); CGAL_assertion(inter_res != boost::none);
const Point_3* pt = const Point_3* pt =

View File

@ -83,12 +83,7 @@ bool sorted_around_edge(
|| coplanar_orientation(o,o_prime,p2,q)==NEGATIVE ); || coplanar_orientation(o,o_prime,p2,q)==NEGATIVE );
typename Kernel::Orientation_3 orientation; typename Kernel::Orientation_3 orientation;
typedef typename Kernel::Point_3 Point_3; const auto s0 = orientation(o_prime, o, p1, p2);
typedef typename cpp11::result_of<
typename Kernel::Orientation_3(Point_3, Point_3, Point_3, Point_3)>::type
Orientation;
Orientation s0 = orientation(o_prime, o, p1, p2);
if ( s0==COPLANAR ) { if ( s0==COPLANAR ) {
//o, o_prime, p1 and p2 are coplanar //o, o_prime, p1 and p2 are coplanar
@ -98,8 +93,8 @@ bool sorted_around_edge(
} }
//o, o_prime, p1 and p2 are not coplanar //o, o_prime, p1 and p2 are not coplanar
Orientation s1 = orientation(o_prime, o, p1, q); const auto s1 = orientation(o_prime, o, p1, q);
Orientation s2 = orientation(o_prime, o, q , p2); const auto s2 = orientation(o_prime, o, q , p2);
if (s0 == POSITIVE) // the angle p1,o,p2 is smaller that Pi. if (s0 == POSITIVE) // the angle p1,o,p2 is smaller that Pi.
return ( s1 == POSITIVE ) return ( s1 == POSITIVE )

View File

@ -276,8 +276,7 @@ class Polygon_mesh_slicer
get(m_vpmap, source(ed, m_tmesh)), get(m_vpmap, source(ed, m_tmesh)),
get(m_vpmap,target(ed, m_tmesh)) get(m_vpmap,target(ed, m_tmesh))
); );
typename cpp11::result_of<typename Traits_::Intersect_3(Plane_3, Segment_3)>::type const auto inter = intersect_3(m_plane, s);
inter = intersect_3(m_plane, s);
CGAL_assertion(inter != boost::none); CGAL_assertion(inter != boost::none);
const Point_3* pt_ptr = boost::get<Point_3>(&(*inter)); const Point_3* pt_ptr = boost::get<Point_3>(&(*inter));
current_poly.push_back( *pt_ptr ); current_poly.push_back( *pt_ptr );

View File

@ -3,16 +3,18 @@ namespace cpp11 {
/*! /*!
\ingroup PkgSTLExtensionRef \ingroup PkgSTLExtensionRef
Alias to the tr1 implementation from boost of the `result_of` mechanism. Alias to the implementation of the `std::result_of` mechanism. When all compilers
When all compilers supported by %CGAL will have a Standard compliant implemention of the supported by \cgal have a Standard compliant implemention of the `std::invoke_result`
the \cpp11 `decltype` feature, it will become an alias to <code>std::result_of</code>. mechanism, it will become an alias to the <code>std::invoke_result</code>.
\sa <a href=https://www.boost.org/libs/utility/utility.htm#result_of><code>boost::result_of</code></a> \sa <a href=https://en.cppreference.com/w/cpp/types/result_of><code>std::result_of</code></a>
*/ */
template <typename F> template <typename F>
struct result_of{ struct result_of {
/// starting from boost version 1.44, it is `boost::tr1_result_of<F>::%type`, and
/// `boost::result_of<F>::%type` otherwise. /*!
It is a type `std::result_of<F>::%type`.
*/
typedef unspecified_type type; typedef unspecified_type type;
}; };

View File

@ -24,7 +24,6 @@
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/circulator.h> #include <CGAL/circulator.h>
#include <CGAL/Iterator_range.h> #include <CGAL/Iterator_range.h>
#include <CGAL/result_of.h>
#include <CGAL/tuple.h> #include <CGAL/tuple.h>
#include <CGAL/use.h> #include <CGAL/use.h>
@ -660,7 +659,8 @@ class Join_input_iterator_1
public: public:
typedef typename std::iterator_traits<I1>::iterator_category iterator_category; typedef typename std::iterator_traits<I1>::iterator_category iterator_category;
typedef std::decay_t<typename cpp11::result_of<Op(arg_type)>::type> value_type; typedef std::decay_t<decltype(std::declval<Op>()(std::declval<arg_type>()))>
value_type;
typedef typename std::iterator_traits<I1>::difference_type difference_type; typedef typename std::iterator_traits<I1>::difference_type difference_type;
typedef value_type const* pointer; typedef value_type const* pointer;
typedef value_type const& reference; typedef value_type const& reference;
@ -746,7 +746,8 @@ class Join_input_iterator_2
public: public:
typedef typename std::iterator_traits<I1>::iterator_category iterator_category; typedef typename std::iterator_traits<I1>::iterator_category iterator_category;
typedef typename cpp11::result_of<Op(arg_type_1, arg_type_2)>::type value_type; typedef decltype(std::declval<Op>()(std::declval<arg_type_1>(), std::declval<arg_type_2>()))
value_type;
typedef typename std::iterator_traits<I1>::difference_type difference_type; typedef typename std::iterator_traits<I1>::difference_type difference_type;
typedef value_type* pointer; typedef value_type* pointer;
typedef value_type& reference; typedef value_type& reference;
@ -840,7 +841,7 @@ class Join_input_iterator_3
public: public:
typedef typename std::iterator_traits<I1>::iterator_category iterator_category; typedef typename std::iterator_traits<I1>::iterator_category iterator_category;
typedef typename cpp11::result_of<Op(arg_type_1, arg_type_2, arg_type_3)>::type typedef decltype(std::declval<Op>()(std::declval<arg_type_1>(), std::declval<arg_type_2>(), std::declval<arg_type_3>()))
value_type; value_type;
typedef typename std::iterator_traits<I1>::difference_type difference_type; typedef typename std::iterator_traits<I1>::difference_type difference_type;
typedef value_type* pointer; typedef value_type* pointer;

View File

@ -21,42 +21,53 @@
#include <CGAL/config.h> #include <CGAL/config.h>
#include <CGAL/disable_warnings.h> #include <CGAL/disable_warnings.h>
// Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' #if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L
// result_of.hpp includes files from boost/preprocessor
// This concerns boost 1_65_1
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable: 4003)
#endif
#include <boost/utility/result_of.hpp>
#if defined(BOOST_MSVC)
# pragma warning(pop)
#endif
#include <boost/version.hpp> // C++>=17
namespace CGAL{ #elif CGAL_CXX11
// Even if for now we use the tr1 result_of implementation, we use the cpp11 #include <type_traits>
// namespace since in the future, that's the decltype version that will be used
namespace cpp11{
template<typename F> #else // C++<11
struct result_of
{ // Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY'
// from boost 1.44 release note https://www.boost.org/users/history/version_1_44_0.html : // result_of.hpp includes files from boost/preprocessor
// New template boost::tr1_result_of that implements the TR1 ResultOf protocol even if boost::result_of uses the C++0x decltype-based implementation. // This concerns boost 1_65_1
#if BOOST_VERSION < 104400 #if defined(BOOST_MSVC)
typedef typename boost::result_of<F>::type type; #pragma warning(push)
#else #pragma warning(disable: 4003)
typedef typename boost::tr1_result_of<F>::type type;
#endif #endif
}; #include <boost/utility/result_of.hpp>
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#include <boost/version.hpp>
} #endif // end C++<11
} namespace CGAL {
namespace cpp11 {
#if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L
template<typename Signature> class result_of;
template<typename F, typename... Args>
class result_of<F(Args...)> : public std::invoke_result<F, Args...> { };
#elif CGAL_CXX11
using std::result_of;
#else // C++<11
using boost::result_of;
#endif // end C++<11
} // end cpp11
} // end CGAL
#include <CGAL/enable_warnings.h> #include <CGAL/enable_warnings.h>
#endif //CGAL_RESULT_OF_H #endif // CGAL_RESULT_OF_H

View File

@ -12,7 +12,6 @@
#ifndef CGAL_TRANSFORMING_ITERATOR_H #ifndef CGAL_TRANSFORMING_ITERATOR_H
#define CGAL_TRANSFORMING_ITERATOR_H #define CGAL_TRANSFORMING_ITERATOR_H
#include <boost/iterator/iterator_adaptor.hpp> #include <boost/iterator/iterator_adaptor.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/type_traits/is_empty.hpp> #include <boost/type_traits/is_empty.hpp>
#include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_integral.hpp>

View File

@ -152,7 +152,7 @@ public:
/*! /*!
Function object type. Function object type.
Must provide Must provide
`CGAL::cpp11::result_of<Intersect_2(A,B)>::%type operator()(A obj1, B obj2)` `boost::optional< boost::variant< T... > > operator()(A obj1, B obj2)`
to compute the intersection between `obj1` and `obj2`, where `A` and `B` can be any type amongst to compute the intersection between `obj1` and `obj2`, where `A` and `B` can be any type amongst
`Line_2`, `Ray_2`, `Segment_2`. `Line_2`, `Ray_2`, `Segment_2`.
*/ */

View File

@ -977,8 +977,6 @@ private:
typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object()); typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object());
typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object()); typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object());
typedef typename cpp11::result_of<typename Traits::Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
Point_2 leftPoint; Point_2 leftPoint;
Point_2 rightPoint; Point_2 rightPoint;
@ -1003,7 +1001,7 @@ private:
} }
else else
{ {
LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); const auto cgalIntersection = i2(cl2(segment), cl2(leftBoundary));
if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection)) if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
{ {
@ -1015,7 +1013,7 @@ private:
} }
else else
{ {
Point_2* result = boost::get<Point_2>(&*cgalIntersection); const Point_2* result = boost::get<Point_2>(&*cgalIntersection);
FT t0 = pdas2(cs2(segment), ct2(segment), *result); FT t0 = pdas2(cs2(segment), ct2(segment), *result);
if (t0 >= FT(1)) if (t0 >= FT(1))
@ -1061,7 +1059,7 @@ private:
} }
else else
{ {
LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); const auto cgalIntersection = i2(cl2(segment), cl2(rightBoundary));
if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection)) if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
{ {
@ -1073,7 +1071,7 @@ private:
} }
else else
{ {
Point_2* result = boost::get<Point_2>(&*cgalIntersection); const Point_2* result = boost::get<Point_2>(&*cgalIntersection);
FT t0 = pdas2(cs2(segment), ct2(segment), *result); FT t0 = pdas2(cs2(segment), ct2(segment), *result);
if (t0 <= FT(0)) if (t0 <= FT(0))
@ -1697,8 +1695,6 @@ private:
typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object()); typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object());
typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object()); typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object());
typedef typename cpp11::result_of<typename Traits::Intersect_2 (Line_2, Line_2)>::type LineLineIntersectResult;
Cone_tree_node* current = startNode; Cone_tree_node* current = startNode;
Point_2 currentLocation(startLocation); Point_2 currentLocation(startLocation);
@ -1713,7 +1709,7 @@ private:
const Point_2& currentSourceImage = current->source_image(); const Point_2& currentSourceImage = current->source_image();
Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation)); Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation));
LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation)); const auto cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation));
CGAL_assertion(bool(cgalIntersection)); CGAL_assertion(bool(cgalIntersection));

View File

@ -25,7 +25,6 @@
#include <CGAL/assertions.h> #include <CGAL/assertions.h>
#include <CGAL/boost/graph/helpers.h> #include <CGAL/boost/graph/helpers.h>
#include <CGAL/number_utils.h> #include <CGAL/number_utils.h>
#include <CGAL/result_of.h>
#include <CGAL/Cartesian_converter.h> #include <CGAL/Cartesian_converter.h>
#include <cmath> #include <cmath>
@ -459,12 +458,10 @@ public:
result_type operator () (const Segment_2& s1, const Line_2& l1, const Segment_2& s2, const Line_2& l2) const result_type operator () (const Segment_2& s1, const Line_2& l1, const Segment_2& s2, const Line_2& l2) const
{ {
typedef typename CGAL::cpp11::result_of<Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
Line_2 s1Line(m_construct_line_2(s1)); Line_2 s1Line(m_construct_line_2(s1));
Line_2 s2Line(m_construct_line_2(s2)); Line_2 s2Line(m_construct_line_2(s2));
LineLineIntersectResult intersectResult1(m_intersect_2(s1Line, l1)); const auto intersectResult1 = m_intersect_2(s1Line, l1);
CGAL_assertion(bool(intersectResult1)); CGAL_assertion(bool(intersectResult1));
if (!intersectResult1) return CGAL::SMALLER; if (!intersectResult1) return CGAL::SMALLER;
@ -476,7 +473,7 @@ public:
CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *p1_ptr);) CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *p1_ptr);)
CGAL_assertion(t1 >= FT(-1)/FT(100000) && t1 <= FT(1)+FT(1)/FT(100000)); CGAL_assertion(t1 >= FT(-1)/FT(100000) && t1 <= FT(1)+FT(1)/FT(100000));
LineLineIntersectResult intersectResult2 = m_intersect_2(s2Line, l2); const auto intersectResult2 = m_intersect_2(s2Line, l2);
CGAL_assertion(bool(intersectResult2)); CGAL_assertion(bool(intersectResult2));
if (!intersectResult2) return CGAL::SMALLER; if (!intersectResult2) return CGAL::SMALLER;