diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h index 6f732e50340..e9a664c2ff8 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h @@ -45,11 +45,9 @@ typedef unspecified_type Do_intersect_3; /*! 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`. Provides the operators: -`CGAL::cpp11::result 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`, `Triangle_3`, `Plane_3` and `Bbox_3`. Relevant herein means that a line primitive (ray, segment, line) is tested diff --git a/AABB_tree/include/CGAL/AABB_segment_primitive.h b/AABB_tree/include/CGAL/AABB_segment_primitive.h index 34851f55a63..a4627c8592e 100644 --- a/AABB_tree/include/CGAL/AABB_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_segment_primitive.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace CGAL { @@ -31,14 +30,17 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_source_3(typename GeomTraits::Segment_3) - >::type reference; + // typedef decltype( + // std::declval()( + // std::declval())) reference; + typedef decltype( + typename GeomTraits::Construct_source_3()( + *std::declval())) reference; typedef boost::readable_property_map_tag category; + typedef Source_of_segment_3_iterator_property_map Self; - inline friend - typename Source_of_segment_3_iterator_property_map::reference - get(Source_of_segment_3_iterator_property_map, Iterator it) + inline friend reference + get(Self, key_type 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`. * 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`. - * 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 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 diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 25b81a5093d..e3ffcacf50c 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -192,14 +192,14 @@ public: typedef typename std::pair Point_and_primitive_id; /// `Intersection_and_primitive_id::%Type::first_type` is found according to - /// the result type of `GeomTraits::Intersect_3::operator()`, - /// (that is cpp11::result_of::type). If it is + /// the result type of `GeomTraits::Intersect_3::operator()`. If it is /// `boost::optional` then it is `T`, and the result type otherwise. template struct Intersection_and_primitive_id { - typedef typename cpp11::result_of< - typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) - >::type Intersection_type; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) Intersection_type; typedef std::pair< typename internal::AABB_tree::Remove_optional::type, @@ -366,8 +366,7 @@ public: template boost::optional< typename Intersection_and_primitive_id::Type > operator()(const Query& query, const typename AT::Primitive& primitive) const { - typename cpp11::result_of::type - inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper::get_datum(primitive,m_traits),query); + auto inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper::get_datum(primitive,m_traits),query); if (!inter_res) return boost::none; return boost::make_optional( std::make_pair(*inter_res, primitive.id()) ); diff --git a/AABB_tree/include/CGAL/AABB_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_triangle_primitive.h index 5c1502d60af..b1b1bd1fe79 100644 --- a/AABB_tree/include/CGAL/AABB_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangle_primitive.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace CGAL { @@ -31,14 +30,18 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_vertex_3(typename GeomTraits::Triangle_3,int) - >::type reference; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) reference; + typedef decltype( + typename GeomTraits::Construct_vertex_3()( + *std::declval(), 0)) reference; typedef boost::readable_property_map_tag category; + typedef Point_from_triangle_3_iterator_property_map Self; - inline friend - typename Point_from_triangle_3_iterator_property_map::reference - get(Point_from_triangle_3_iterator_property_map, Iterator it) + inline friend reference + get(Self, key_type it) { 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`. * 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`. - * 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 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 diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 66783dcff9b..4400335e8e3 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -18,7 +18,6 @@ #include -#include #include namespace CGAL @@ -31,14 +30,18 @@ namespace CGAL //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_vertex_3(typename GeomTraits::Tetrahedron_3, int) - >::type reference; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) reference; + // typedef decltype( + // typename GeomTraits::Construct_vertex_3()( + // *std::declval(), 0)) reference; // fails polyhedron demo! typedef boost::readable_property_map_tag category; + typedef Point_from_cell_iterator_proprety_map Self; - inline friend - typename Point_from_cell_iterator_proprety_map::reference - get(Point_from_cell_iterator_proprety_map, Iterator it) + inline friend reference + get(Self, key_type it) { typename GeomTraits::Construct_point_3 point; return point(it->vertex(1)->point()); diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_2.h index 54be46b256a..37f94cf45fe 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_2.h @@ -22,7 +22,6 @@ #include -#include #include #include namespace CGAL { @@ -107,25 +106,25 @@ public: {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) left() const { return typename R::Construct_circular_min_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) right() const { return typename R::Construct_circular_max_vertex_2()(*this); @@ -141,19 +140,19 @@ public: return typename R::Is_y_monotone_2()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_circle() const { return typename R::Construct_circle_2()(*this); } - typename cpp11::result_of::type + decltype(auto) center() const { return typename R::Construct_center_2()(*this); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return typename R::Compute_squared_radius_2()(*this); diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h index 99cfbbfeced..8dbadf1ebcf 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h @@ -21,7 +21,6 @@ #include -#include #include #include @@ -72,15 +71,13 @@ public: : RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p)) {} - typename - cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_circular_x_2()(*this); } - typename - cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_circular_y_2()(*this); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h index f6ef588c083..4288ef1657b 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h @@ -639,13 +639,13 @@ public: return _support; } - typename cpp11::result_of::type + decltype(auto) center() const { return supporting_circle().center(); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return supporting_circle().squared_radius(); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 997911312b5..09696e5069c 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -357,22 +357,8 @@ namespace CircularFunctors { //using CK::Linear_kernel::Intersect_2::operator(); - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; - - //need a specialization for the case of 3 object in CK - template - struct result { - typedef OutputIterator type; - }; - template - typename Intersection_traits::result_type + decltype(auto) operator()(const A& a, const B& b) const{ return typename CK::Linear_kernel::Intersect_2()(a,b); } @@ -482,21 +468,6 @@ namespace CircularFunctors { { public: - template - struct result; - - template - struct result - { - typedef typename CK::Polynomial_1_2 type; - }; - - template - struct result - { - typedef typename CK::Polynomial_for_circles_2_2 type; - }; - typename CK::Polynomial_1_2 operator() ( const typename CK::Line_2 & l ) { @@ -1014,22 +985,8 @@ namespace CircularFunctors { typedef typename CK::Point_2 Point_2; typedef typename CK::Circle_2 Circle_2; public: - template - struct result{ - typedef FT type; - }; - template - struct result { - typedef typename cpp11::result_of::type type; - }; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - - typename cpp11::result_of::type + decltype(auto) operator()( const Circle_2& c) const { 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 { return LK_Compute_squared_radius_2()(p, q, r); } - typename cpp11::result_of::type + decltype(auto) operator()(const Circular_arc_2& c) const { return c.rep().squared_radius(); } diff --git a/Circular_kernel_2/include/CGAL/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Line_arc_2.h index 3bd75815e8c..deb4cecc458 100644 --- a/Circular_kernel_2/include/CGAL/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Line_arc_2.h @@ -21,7 +21,6 @@ #include -#include #include namespace CGAL { @@ -91,25 +90,25 @@ public: : RLine_arc_2(a) {} - typename cpp11::result_of< typename R::Construct_circular_source_vertex_2(Line_arc_2)>::type + decltype(auto) source() const { 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 { 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 { 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 { return typename R::Construct_circular_max_vertex_2()(*this); diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_3.h index 86c0756bda4..6843fac6003 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_3.h @@ -20,7 +20,6 @@ #include -#include #include namespace CGAL { @@ -117,19 +116,19 @@ namespace CGAL { : RCircular_arc_3(a) {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_circle() const { return typename R::Construct_circle_3()(*this); diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h index 36c0ed41c18..f9f941d2d8b 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h @@ -20,7 +20,6 @@ #include -#include #include #include @@ -196,15 +195,15 @@ public: - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_circular_x_3()(*this);} - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_circular_y_3()(*this);} - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_circular_z_3()(*this);} diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h index 30cd1bd3236..48972182b0c 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h @@ -567,15 +567,6 @@ template < class SK > \ typedef typename SK::Kernel_base::Circle_3 RCircle_3; typedef typename Circle_3::Rep Rep; public: - template - struct result { - typedef forwarded_result_type type; - }; - - template - struct result { - typedef const forwarded_result_type& type; - }; forwarded_result_type operator()(const Point_3& p, const FT& sr, @@ -1019,44 +1010,17 @@ template < class SK > \ public: - template - struct result; - - // the binary overload always goes to Linear::Intersect_3 - template - struct result - { typedef typename Intersection_traits::result_type type; }; - - // This one is only for the spherical kernel, O is an output iterator - template - struct result - { typedef OutputIterator type;}; - - // there is no quaternary form in the linear Kernel - template - struct result - { typedef OutputIterator type; }; - - //only ternary from the linear kernel - template - struct result { - typedef boost::optional< - boost::variant< Point_3, - Line_3, - Plane_3 > > type; - }; - //using SK::Linear_kernel::Intersect_3::operator(); typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3; template - typename Intersection_traits::result_type + decltype(auto) operator()(const A& a, const B& b) const{ return Intersect_linear_3()(a,b); } - typename result::type + decltype(auto) operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const { return Intersect_linear_3()(p, q, r); diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h index 7bd216c466b..ef7bd172f99 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h @@ -41,33 +41,6 @@ namespace CGAL { typedef typename SK::Polynomials_for_circle_3 result_type_for_circle; //using LinearFunctors::Get_equation::operator(); - template - struct result; - - template - struct result - { - typedef result_type_for_sphere type; - }; - - template - struct result - { - typedef result_type_for_plane type; - }; - - template - struct result - { - typedef result_type_for_line type; - }; - - template - struct result - { - typedef result_type_for_circle type; - }; - result_type_for_sphere operator() ( const typename SK::Sphere_3 & s ) { diff --git a/Circular_kernel_3/include/CGAL/Line_arc_3.h b/Circular_kernel_3/include/CGAL/Line_arc_3.h index e2413b1317c..f9955774c9b 100644 --- a/Circular_kernel_3/include/CGAL/Line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Line_arc_3.h @@ -20,7 +20,6 @@ #include -#include #include @@ -122,31 +121,31 @@ namespace CGAL { : RLine_arc_3(a) {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) lower_xyz_extremity() const { return typename R::Construct_circular_min_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) higher_xyz_extremity() const { return typename R::Construct_circular_max_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_line() const { return typename R::Construct_line_3()(*this); diff --git a/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h b/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h index adeb88c6e26..dfc0b27c7ba 100644 --- a/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h +++ b/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h @@ -22,7 +22,6 @@ #include #include -#include namespace CGAL { namespace Convex_hull_3 { @@ -37,14 +36,14 @@ struct Forward_functor Forward_functor(const PointPropertyMap& vpm, const F& f) : F(f), vpm_(vpm) {} template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q) const { return static_cast(this)->operator()(get(vpm_, p), get(vpm_, q)); } template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q, const Vertex& r) const { return static_cast(this)->operator()(get(vpm_, p), @@ -53,7 +52,7 @@ struct Forward_functor } template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q, const Vertex& r, const Vertex& s) const { return static_cast(this)->operator()(get(vpm_, p), diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 82d6ff20f58..0cdf7b4bd66 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -470,6 +470,7 @@ public: }; // Macro helpers to build the kernel objects +#define CGAL_PARAM(z, n, t) std::declval() #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_LEXACT(z,n,t) CGAL::exact( l##n ) @@ -857,7 +858,8 @@ struct Lazy_construction_bbox CGAL_NO_UNIQUE_ADDRESS EC ec; template - 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); // 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 EC ec; - template - struct result { }; - -#define CGAL_RESULT_NT(z, n, d) \ - template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \ - struct result { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \ - typedef Lazy_exact_nt< \ - typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of::type >::type >::type > type; \ - }; - - BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _) - template auto operator()(L const&...l) const -> Lazy_exact_nt>> @@ -1007,8 +995,6 @@ struct Lazy_construction_nt { return new Lazy_rep_0 >(ec( CGAL::exact(l)... )); } } - -#undef CGAL_RESULT_NT }; @@ -1404,7 +1390,7 @@ struct Lazy_construction_object public: template - result_type + decltype(auto) operator()(const L1& l1) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1437,7 +1423,7 @@ public: } template - result_type + decltype(auto) operator()(const L1& l1, const L2& l2) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1491,7 +1477,7 @@ CGAL_Kernel_obj(Point_3) } template - result_type + decltype(auto) 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); @@ -1530,7 +1516,7 @@ CGAL_Kernel_obj(Point_3) //____________________________________________________________ // The magic functor that has Lazy as result type. // 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 { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) @@ -1652,20 +1638,23 @@ struct Lazy_construction_variant { struct result { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \ typedef typename Type_mapper< \ - typename cpp11::result_of::type, AK, LK>::type type; \ + decltype(std::declval()(BOOST_PP_ENUM(n, CGAL_PARAM, A))), AK, LK>::type type; \ }; BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) template - typename result::type + decltype(auto) operator()(const L1& l1, const L2& l2) const { - typedef typename cpp11::result_of::type result_type; + typedef typename result::type result_type; - typedef typename cpp11::result_of::type, - typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, - typename Type_mapper::type)>::type ET; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>())) AT; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>())) ET; + + typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2))) AT; + typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2))) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; @@ -1706,19 +1695,23 @@ struct Lazy_construction_variant { } template - typename result::type + decltype(auto) operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; - typedef typename cpp11::result_of::type, - typename Type_mapper::type, - typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, - typename Type_mapper::type, - typename Type_mapper::type)>::type ET; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>(), + // std::declval::type>())) AT; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>(), + // std::declval::type>())) ET; + + typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT; + typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; + try { Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); @@ -1770,7 +1763,7 @@ struct Lazy_construction { typedef typename boost::remove_cv< typename boost::remove_reference < typename AC::result_type >::type >::type AT; 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::type E2A; @@ -1781,7 +1774,7 @@ struct Lazy_construction { #define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \ template \ - result_type \ + decltype(auto) \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ typedef Lazy< AT, ET, E2A> Handle; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ @@ -1799,7 +1792,7 @@ struct Lazy_construction { BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary - result_type + decltype(auto) operator()() const { typedef Lazy Handle; @@ -1830,27 +1823,18 @@ struct Lazy_construction CGAL_NO_UNIQUE_ADDRESS EC ec; // 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 { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \ - typedef typename Type_mapper< typename cpp11::result_of::type, AK, LK>::type type; \ -}; - BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) #define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \ template \ - typename cpp11::result_of::type \ + decltype(auto) \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ - typedef typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \ - 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 typename Type_mapper()(BOOST_PP_ENUM(n, CGAL_PARAM, E))),EK,EK>::type ET; \ + typedef typename Type_mapper()(BOOST_PP_ENUM(n, CGAL_PARAM, A))),AK,AK>::type AT; \ typedef Lazy< AT, ET, E2A> Handle; \ - typedef typename cpp11::result_of::type result_type; \ + typedef typename result::type result_type; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ Protect_FPU_rounding P; \ try { \ @@ -1866,13 +1850,13 @@ struct result { \ BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary - typename Type_mapper< typename cpp11::result_of::type ,AK, LK>::type + decltype(auto) operator()() const { - typedef typename cpp11::result_of::type AT; - typedef typename cpp11::result_of::type ET; + typedef decltype(std::declval()()) AT; + typedef decltype(std::declval()()) ET; typedef Lazy Handle; - typedef typename Type_mapper< typename cpp11::result_of::type ,AK, LK>::type result_type; + typedef typename Type_mapper::type result_type; return result_type( Handle(new Lazy_rep_0()) ); } diff --git a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp index 6d6b9737c34..a0793b58c8b 100644 --- a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp +++ b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp @@ -35,7 +35,7 @@ int main() obj = CGAL::intersection(s1,s2); // check the variant return type - CGAL::cpp11::result_of::type o_variant = CGAL::intersection(t1,t2); + const auto o_variant = CGAL::intersection(t1,t2); if(!o_variant) { std::cerr << "ERROR, empty" << std::endl; return EXIT_FAILURE; @@ -75,7 +75,7 @@ int main() } // check the variant return type - CGAL::cpp11::result_of::type o_variant = CGAL::intersection(t1,t2); + const auto o_variant = CGAL::intersection(t1,t2); if(!o_variant) { std::cerr << "ERROR, empty" << std::endl; return EXIT_FAILURE; diff --git a/Generator/include/CGAL/internal/Generic_random_point_generator.h b/Generator/include/CGAL/internal/Generic_random_point_generator.h index a161df1da76..76c52dd55cb 100644 --- a/Generator/include/CGAL/internal/Generic_random_point_generator.h +++ b/Generator/include/CGAL/internal/Generic_random_point_generator.h @@ -18,6 +18,7 @@ #include #include #include +#include #include diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 740fe435f9e..cafd0428ef8 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -41,13 +40,13 @@ #define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const A& a, const B& b) { \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const B& a, const 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) \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const A & a, const A & b) { \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } @@ -123,11 +122,11 @@ namespace internal { // the real type. // Overloads for empty returns are also provided. template - inline typename cpp11::result_of::type - intersection_return(T&& t) { return typename cpp11::result_of::type(std::forward(t)); } + decltype(auto) + intersection_return(T&& t) { return decltype(std::declval()(std::declval(), std::declval()))(std::forward(t)); } template - inline typename cpp11::result_of::type - intersection_return() { return typename cpp11::result_of::type(); } + decltype(auto) + intersection_return() { return decltype(std::declval()(std::declval(), std::declval()))(); } // Something similar to wrap around boost::get and object_cast to // prevent ifdefing too much. Another way could be to introduce an @@ -153,14 +152,14 @@ const T* intersect_get(const boost::variant & v) { } template -typename cpp11::result_of::Kernel::Intersect_2(A, B)>::type +decltype(auto) intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_2_object()(a, b); } template -typename cpp11::result_of::Kernel::Intersect_3(A, B)>::type +decltype(auto) intersection_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_3_object()(a, b); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h index 2ade2d2fcab..92d6d2e1360 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h @@ -57,7 +57,7 @@ namespace CGAL { // the special plane_3 function template inline -typename cpp11::result_of::type +decltype(auto) intersection(const Plane_3 &plane1, const Plane_3 &plane2, const Plane_3 &plane3) { diff --git a/Intersections_3/test/Intersections_3/call_test.cpp b/Intersections_3/test/Intersections_3/call_test.cpp index 34c45488e5b..90f595bcbb6 100644 --- a/Intersections_3/test/Intersections_3/call_test.cpp +++ b/Intersections_3/test/Intersections_3/call_test.cpp @@ -25,9 +25,9 @@ typedef CGAL::Bbox_3 Bbox_3; template void call_intersection_global(const A& a, const B& b) { - typename CGAL::cpp11::result_of::type x = CGAL::intersection(a, b); - typename CGAL::cpp11::result_of::type y = CGAL::intersection(b, a); - typename CGAL::cpp11::result_of::type z = CGAL::intersection(b, a); + const auto x = CGAL::intersection(a, b); + const auto y = CGAL::intersection(b, a); + const auto z = CGAL::intersection(b, a); CGAL_USE(x); CGAL_USE(y); CGAL_USE(z); @@ -42,8 +42,8 @@ void call_do_intersect_global(const A& a, const B& b) { template void call_intersection_with_kernel(const A& a, const B& b, const K&) { typedef typename K::Intersect_3 Intersect; - typename CGAL::cpp11::result_of::type x = Intersect()(a, b); - typename CGAL::cpp11::result_of::type y = Intersect()(b, a); + const auto x = Intersect()(a, b); + const auto y = Intersect()(b, a); } template @@ -83,7 +83,7 @@ int main(int argc, char**) // call_intersection_global(Pl(), Cub()); // special - CGAL::cpp11::result_of::type plplpl = CGAL::intersection(Pl(), Pl(), Pl()); + const auto plplpl = CGAL::intersection(Pl(), Pl(), Pl()); call_intersection_global(Tr(), S()); call_intersection_global(Tr(), L()); diff --git a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h index 5cc62d8227c..7024d483aa1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h @@ -46,10 +46,9 @@ the following function overloads are also available. The iterator versions of those functions can be used in conjunction with `Dispatch_output_iterator`. -Since both the number of intersections, if any, and their types, depend -on the arguments, the function expects an output iterator on -`cpp11::result_of::%type`, as -presented below. +Since both the number of intersections, if any, and types of the interesection results +depend on the arguments, the function expects an output iterator on `K::Intersect_2(Type1, Type2)` +as presented below. */ /// @{ diff --git a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h index 3dbd6b566ae..0c1a977f305 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h @@ -57,20 +57,16 @@ the following function overloads are also available. The iterator versions of those functions can be used in conjunction with `Dispatch_output_iterator`. -Since both the number of intersections, if any, and their types, depend -on the arguments, the function expects an output iterator on -`cpp11::result_of::%type`, +Since both the number of intersections, if any, and types of the interesection results +depend on the arguments, the function expects an output iterator on `Kernel::Intersect_3(Type1, Type2)` as presented below. */ /// @{ /*! -Copies in the output iterator the intersection elements between the -two objects. `intersections` iterates on -elements of type `result_of< Intersect_3(SphericalType1, SphericalType2) >`, in lexicographic order, -when this ordering is defined on the computed objects, - -where `SphericalType1` and `SphericalType2` can both be one of: +Constructs the intersection elements between the two input +objects and stores them in the OutputIterator in lexicographic order, +where both, `SphericalType1` and `SphericalType2`, can be either - `Sphere_3`, - `Plane_3`, @@ -90,7 +86,7 @@ type can be and if the two objets `obj1` and `obj2` are equal, - `Line_3` or `Circle_3` 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), - `Circular_arc_3` in case of an overlap of two circular arcs or diff --git a/Kernel_23/doc/Kernel_23/CGAL/intersections.h b/Kernel_23/doc/Kernel_23/CGAL/intersections.h index 99fab06d311..1b6c85341a3 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/intersections.h @@ -101,12 +101,15 @@ The following tables give the possible values for `Type1` and `Type2`. \cgalHeading{2D Intersections} -The return type can be obtained through `CGAL::cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +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.
- + + @@ -197,12 +200,15 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ \cgalHeading{3D Intersections} -The return type can be obtained through `CGAL::cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +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.
Type1
Type1 Type2 Return Type: `T...`
- + + @@ -356,9 +362,9 @@ The following examples demonstrate the most common use of `intersection()` functions with the 2D and 3D Linear %Kernel. 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 -if you use a C++ compiler which supports `auto`, -but you must anyways know that the result type is a `boost::optional >`, in order to unpack the point or segment. +The result type can be specified through the placeholder type specifier `auto`, +but you must anyway know that the result type is a `boost::optional >`, +in order to unpack the point or segment. `boost::optional` comes in as there might be no intersection. `boost::variant` comes in @@ -380,7 +386,7 @@ a standard library algorithm. */ template -cpp11::result_of::type +decltype(auto) intersection(Type1 obj1, Type2 obj2); /*! @@ -388,7 +394,7 @@ returns the intersection of 3 planes, which can be a point, a line, a plane, or empty. */ template -boost::optional< boost::variant< Point_3, Line_3, Plane_3 > > +decltype(auto) intersection(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3); diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 61033d6d3ab..c1a76efc8aa 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -8409,8 +8409,6 @@ public: \cgalRefines `AdaptableFunctor` (with two arguments) \sa \link intersection_grp `CGAL::intersection()` \endlink - \sa `CGAL::cpp11::result_of` - */ class Intersect_2 { public: @@ -8424,7 +8422,7 @@ public: `Type1` and `Type2`, for all pairs `Type1` and `Type2`. For details see the reference manual page for \link intersection_grp `CGAL::intersection()` \endlink. */ - CGAL::cpp11::result_of::type + decltype(auto) operator()(Type1 obj1, Type2 obj2); /// @} @@ -8438,8 +8436,6 @@ public: \cgalRefines `AdaptableFunctor` (with two or three arguments) \sa intersection_linear_grp - \sa `CGAL::cpp11::result_of` - */ class Intersect_3 { public: @@ -8453,8 +8449,8 @@ public: objects of type `Type1` and `Type2`. For details see the reference manual page for \ref intersection_linear_grp. */ - CGAL::cpp11::result_of::type - operator()(Type1 obj1, Type2 obj2); + decltype(auto) + operator()(Type1 obj1, Type2 obj2); diff --git a/Kernel_23/doc/Kernel_23/Kernel_23.txt b/Kernel_23/doc/Kernel_23/Kernel_23.txt index 0947dbecd5e..3777a054165 100644 --- a/Kernel_23/doc/Kernel_23/Kernel_23.txt +++ b/Kernel_23/doc/Kernel_23/Kernel_23.txt @@ -493,23 +493,19 @@ especially integer types and rationals. \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 -in a type-safe way \cgal uses return values of type -`boost::optional< boost::variant< T... > >` were `T...` is a -list of all possible resulting geometric objects. The exact result -type of an intersection can be determined through the metafunction -`cpp11::result_of` or -`cpp11::result_of`, where -`Type1` and `Type2` are the types of the objects used in the -intersection computation. +Some functions, for example \link intersection_linear_grp `intersection()`\endlink, +can return different types of objects. To achieve this in a type-safe way \cgal uses +return values of type `boost::optional< boost::variant< T... > >` where `T...` is a +list of all possible resulting geometric objects. The exact result type of an intersection +can be specified through the placeholder type specifier `auto`. Example ------- -In the following example, `result_of` is used to query the type of the -return value for the intersection computation: +In the following example, `auto` is used to specify the type of the return value +for the intersection computation: \code{.cpp} typedef Cartesian K; @@ -521,13 +517,9 @@ Segment_2 segment_1, segment_2; std::cin >> segment_1 >> segment_2; -/* C++11 */ -// auto v = intersection(segment_1, segment_2); - -/* C++03 */ -cpp11::result_of::type -v = intersection(segment_1, segment_2); -if(v) { +/* use auto */ +auto v = intersection(segment_1, segment_2); +if (v) { /* not empty */ if (const Point_2 *p = boost::get(&*v) ) { /* do something with *p */ diff --git a/Kernel_23/examples/Kernel_23/MyKernel.cpp b/Kernel_23/examples/Kernel_23/MyKernel.cpp index 7f0b862067a..13eec454b3d 100644 --- a/Kernel_23/examples/Kernel_23/MyKernel.cpp +++ b/Kernel_23/examples/Kernel_23/MyKernel.cpp @@ -56,8 +56,7 @@ int main() K::Intersect_2 intersection; - CGAL::cpp11::result_of::type - intersect = intersection(s1, s2); + const auto intersect = intersection(s1, s2); K::Construct_cartesian_const_iterator_2 construct_it; K::Cartesian_const_iterator_2 cit = construct_it(a); diff --git a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp index 63c49c37585..ebd4343d304 100644 --- a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp +++ b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp @@ -25,8 +25,7 @@ int main(){ EK::Triangle_3 t2=to_exact(t1); EK::Line_3 l2=to_exact(l1); - CGAL::cpp11::result_of::type - inter = CGAL::intersection(t2,l2); + const auto inter = CGAL::intersection(t2,l2); // As we are sure that there IS an intersection // and that the intersection IS a point diff --git a/Kernel_23/examples/Kernel_23/intersection_get.cpp b/Kernel_23/examples/Kernel_23/intersection_get.cpp index 2e6c66cec4f..ff2332a153c 100644 --- a/Kernel_23/examples/Kernel_23/intersection_get.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_get.cpp @@ -12,8 +12,7 @@ int main() Segment_2 seg(Point_2(0,0), Point_2(2,2)); Line_2 lin(1,-1,0); - CGAL::cpp11::result_of::type - result = intersection(seg, lin); + const auto result = intersection(seg, lin); if (result) { if (const Segment_2* s = boost::get(&*result)) { std::cout << *s << std::endl; diff --git a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp index 1c511387b65..ffe5c09c7d8 100644 --- a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp @@ -26,11 +26,7 @@ int main() Segment_2 seg(Point_2(0,0), Point_2(1,1)); Line_2 lin(1,-1,0); - // with C++11 support - // auto result = intersection(seg, lin); - // without C++11 - CGAL::cpp11::result_of::type - result = intersection(seg, lin); + const auto result = intersection(seg, lin); if (result) { boost::apply_visitor(Intersection_visitor(), *result); } else { diff --git a/Kernel_23/examples/Kernel_23/intersections.cpp b/Kernel_23/examples/Kernel_23/intersections.cpp index bbe913a36df..0959cd2f474 100644 --- a/Kernel_23/examples/Kernel_23/intersections.cpp +++ b/Kernel_23/examples/Kernel_23/intersections.cpp @@ -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; struct Intersector{ - typedef CGAL::cpp11::result_of::type result_type; const Segment& s; K::Intersect_2 intersect; Intersector(const Segment& seg): s(seg) {} - result_type + decltype(auto) operator() ( const Segment& other) const { return intersect(s, other); diff --git a/Kernel_23/include/CGAL/Bbox_3.h b/Kernel_23/include/CGAL/Bbox_3.h index 1e5bb0d8eb9..2f5b6e49425 100644 --- a/Kernel_23/include/CGAL/Bbox_3.h +++ b/Kernel_23/include/CGAL/Bbox_3.h @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index c9522d24c02..a1cc8092654 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -24,7 +24,6 @@ #include #include #include -#include namespace CGAL { @@ -89,13 +88,13 @@ public: Circle_2(const Point_2 & center) : RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {} - typename cpp11::result_of::type + decltype(auto) center() const { return R().construct_center_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return R().compute_squared_radius_2_object()(*this); diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index e2c5c6c9adc..0b42941a064 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -93,8 +93,7 @@ public: Circle_3(const Rep& r) : Rep(r) {} - typename cpp11::result_of - ::type + decltype(auto) diametral_sphere() const { return typename R::Construct_sphere_3()(*this); @@ -110,8 +109,7 @@ public: return typename R::Construct_sphere_3()(*this).squared_radius(); } - typename cpp11::result_of - ::type + decltype(auto) supporting_plane() const { return typename R::Construct_plane_3()(*this); diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index 6517028cfa0..37f1196d794 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -93,19 +92,19 @@ public: return R().construct_perpendicular_direction_2_object()(*this,o); } - typename cpp11::result_of::type + decltype(auto) dx() const { return R().compute_dx_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dy() const { return R().compute_dy_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) delta(int i) const { CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) ); diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 3c491375d03..77be97c63be 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -99,25 +98,25 @@ public: Vector_3 vector() const { return to_vector(); } - typename cpp11::result_of::type + decltype(auto) dx() const { return R().compute_dx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dy() const { return R().compute_dy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dz() const { return R().compute_dz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) delta(int i) const { CGAL_kernel_precondition( i >= 0 && i <= 2 ); diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 0dd33eb0b9f..9c241a184ec 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -86,67 +86,67 @@ public: : Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.zmin(), bbox.xmax(), bbox.ymax(), bbox.zmax())) {} - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_min_vertex_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_max_vertex_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) xmin() const { return R().compute_xmin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) xmax() const { return R().compute_xmax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymin() const { return R().compute_ymin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymax() const { return R().compute_ymax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) zmin() const { return R().compute_zmin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) zmax() const { return R().compute_zmax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) min_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); @@ -158,7 +158,7 @@ public: return zmin(); } - typename cpp11::result_of::type + decltype(auto) max_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); @@ -206,7 +206,7 @@ public: return R().is_degenerate_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) volume() const { return R().compute_volume_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 187b9df2b86..10041882ce5 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace CGAL { @@ -82,13 +81,13 @@ public: 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())) {} - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_min_vertex_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_max_vertex_2_object()(*this); @@ -107,43 +106,43 @@ public: } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) xmin() const { return R().compute_xmin_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) xmax() const { return R().compute_xmax_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymin() const { return R().compute_ymin_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymax() const { return R().compute_ymax_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) min_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 ); @@ -153,7 +152,7 @@ public: return ymin(); } - typename cpp11::result_of::type + decltype(auto) max_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 ); diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index fe54b5fe96b..683b7fe9255 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -87,9 +87,13 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) //}; // 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) \ template < typename K1, typename 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; }; #include diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index d8b307db838..1a803d094ae 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1715,8 +1715,7 @@ namespace CommonKernelFunctors { Line l1 = construct_line(l11, l12); Line l2 = construct_line(l21, l22); - typename cpp11::result_of::type - res = typename K::Intersect_3()(l1,l2); + const auto res = typename K::Intersect_3()(l1,l2); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -2115,8 +2114,7 @@ namespace CommonKernelFunctors { Plane plane = construct_plane(p1, p2, p3); Line line = construct_line( l1, l2 ); - typename cpp11::result_of::type - res = typename K::Intersect_3()(plane,line); + const auto res = typename K::Intersect_3()(plane,line); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -2129,8 +2127,7 @@ namespace CommonKernelFunctors { { Line line = construct_line( l1, l2 ); - typename cpp11::result_of::type - res = typename K::Intersect_3()(plane,line); + const auto res = typename K::Intersect_3()(plane,line); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -2593,15 +2590,6 @@ namespace CommonKernelFunctors { typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; public: - template - struct result { - typedef const Point_3& type; - }; - - template - struct result { - typedef Point_3 type; - }; const Point_3& operator()( const Segment_3& s, int i) const @@ -3332,11 +3320,10 @@ namespace CommonKernelFunctors { bool operator()(const Sphere_3& s1, const Sphere_3& s2, const Point_3& a, const Point_3& b) const { - typedef typename K::Circle_3 Circle_3; - typedef typename K::Point_3 Point_3; - typedef typename K::Segment_3 Segment_3; - typedef typename K::Plane_3 Plane_3; - typedef typename K::Intersect_3 Intersect_3; + typedef typename K::Circle_3 Circle_3; + typedef typename K::Point_3 Point_3; + typedef typename K::Segment_3 Segment_3; + typedef typename K::Plane_3 Plane_3; 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; const Circle_3 circ(s1, s2); const Plane_3& plane = circ.supporting_plane(); - typename CGAL::cpp11::result_of::type - optional = K().intersect_3_object()(plane, Segment_3(a, b)); + const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting" " plane"); @@ -3548,17 +3534,10 @@ namespace CommonKernelFunctors { class Intersect_2 { public: - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; // 25 possibilities, so I keep the template. template - typename Intersection_traits::result_type + decltype(auto) operator()(const T1& t1, const T2& t2) const { return Intersections::internal::intersection(t1, t2, K()); } }; @@ -3568,29 +3547,14 @@ namespace CommonKernelFunctors { { typedef typename K::Plane_3 Plane_3; public: - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; - - template - struct result { - 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. template - typename cpp11::result_of< Intersect_3(T1, T2) >::type + decltype(auto) operator()(const T1& t1, const T2& t2) const { 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 { return Intersections::internal::intersection(pl1, pl2, pl3, K() ); } }; diff --git a/Kernel_23/include/CGAL/Kernel_checker.h b/Kernel_23/include/CGAL/Kernel_checker.h index b16a3d4806c..bd35c115a08 100644 --- a/Kernel_23/include/CGAL/Kernel_checker.h +++ b/Kernel_23/include/CGAL/Kernel_checker.h @@ -21,7 +21,6 @@ // This file contains the definition of a kernel traits checker. #include -#include #include #include @@ -80,19 +79,14 @@ public: { } template - typename Pairify::type, - typename CGAL::cpp11::result_of::type>::result_type + decltype(auto) operator()(const A&... a) const { - typedef typename CGAL::cpp11::result_of::type result_type_1; - typedef typename CGAL::cpp11::result_of::type result_type_2; - result_type_1 res1 = p1(a.first...); - result_type_2 res2 = p2(a.second...); - if (! cmp(res1, res2)) - { - CGAL_kernel_assertion(false); - } - return Pairify()(res1, res2); + auto res1 = p1(a.first...); + auto res2 = p2(a.second...); + + CGAL_kernel_assertion(cmp(res1, res2)); + return Pairify()(res1, res2); } }; diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index 1cb4aaff9bb..659cde8d50b 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -21,7 +21,6 @@ #include #include #include -#include #include namespace CGAL { @@ -107,25 +106,25 @@ public: return Direction_3(a(), b(), c()); } - typename cpp11::result_of::type + decltype(auto) a() const { return R().compute_a_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) b() const { return R().compute_b_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) c() const { return R().compute_c_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) d() const { return R().compute_d_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index 7358d0dc46b..1d4403354b7 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -24,7 +24,6 @@ #include #include #include -#include namespace CGAL { @@ -93,26 +92,26 @@ public: swap(a.rep(), b.rep()); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_2()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_2()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); return (i==0) ? x() : y(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -129,19 +128,19 @@ public: } - typename cpp11::result_of::type + decltype(auto) hx() const { return typename R::Compute_hx_2()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return typename R::Compute_hy_2()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return typename R::Compute_hw_2()(*this); @@ -152,7 +151,7 @@ public: return 2; } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 01b07bd3e0e..a8487afeb38 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -90,49 +90,49 @@ public: swap(a.rep(), b.rep()); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_3()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_3()(*this); } - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_z_3()(*this); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -151,7 +151,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index b0568ee2cd3..732ea145918 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -81,13 +80,13 @@ public: : RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R().construct_source_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) second_point() const { return R().construct_second_point_2_object()(*this); @@ -108,7 +107,7 @@ public: construct_scaled_vector(construct_vector(source(), second_point()), i)); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index 242edee56c5..6854f30a46f 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace CGAL { @@ -99,25 +98,25 @@ public: bool collinear_has_on(const Point_3 &p) const; */ - typename cpp11::result_of::type + decltype(auto) point(const FT i) const { return R().construct_point_on_3_object()(*this, i); } - typename cpp11::result_of::type + decltype(auto) source() const { return R().construct_source_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) second_point() const { return R().construct_second_point_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index a318f285648..8143beeb5c0 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -23,7 +23,6 @@ #include #include #include -#include namespace CGAL { @@ -70,45 +69,53 @@ public: Segment_2(const Point_2 &sp, const Point_2 &ep) : RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R_().construct_source_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return R_().construct_target_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); } - typename cpp11::result_of::type + decltype(auto) end() const { 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::type - min BOOST_PREVENT_MACRO_SUBSTITUTION() const; + decltype(auto) + max BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xy_2 less_xy; + return less_xy(source(), target()) ? target() : source(); + } - typename cpp11::result_of::type - max BOOST_PREVENT_MACRO_SUBSTITUTION () const; + decltype(auto) + vertex(int i) const + { return (i%2 == 0) ? source() : target(); } - typename cpp11::result_of::type - vertex(int i) const; + decltype(auto) + point(int i) const + { return vertex(i); } - typename cpp11::result_of::type - point(int i) const; - - typename cpp11::result_of::type - operator[](int i) const; + decltype(auto) + operator[](int i) const + { return vertex(i); } bool is_horizontal() const; bool is_vertical() const; @@ -170,47 +177,6 @@ public: } }; -template < class R_ > -CGAL_KERNEL_INLINE -typename cpp11::result_of )>::type -Segment_2::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 )>::type -Segment_2::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, int )>::type -Segment_2::vertex(int i) const -{ - return (i%2 == 0) ? source() : target(); -} - -template < class R_ > -inline -typename cpp11::result_of, int )>::type -Segment_2::point(int i) const -{ - return vertex(i); -} - -template < class R_ > -inline -typename cpp11::result_of, int )>::type -Segment_2::operator[](int i) const -{ - return vertex(i); -} template < class R_ > CGAL_KERNEL_INLINE diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index da8783d67fb..fa0e4e7569d 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -68,44 +68,51 @@ public: Segment_3(const Point_3& sp, const Point_3& ep) : Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R_().construct_source_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return R_().construct_target_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); } - typename cpp11::result_of::type + decltype(auto) end() const { return target(); } - typename cpp11::result_of::type - min BOOST_PREVENT_MACRO_SUBSTITUTION () const; + decltype(auto) + min BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xyz_3 less_xyz; + return less_xyz(source(), target()) ? source() : target(); + } - typename cpp11::result_of::type - max BOOST_PREVENT_MACRO_SUBSTITUTION () const; + decltype(auto) + max BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xyz_3 less_xyz; + return less_xyz(source(), target()) ? target() : source(); + } - typename cpp11::result_of::type - vertex(int i) const; + decltype(auto) + vertex(int i) const + { return (i%2 == 0) ? source() : target(); } - typename cpp11::result_of::type + decltype(auto) point(int i) const { return vertex(i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); } @@ -161,32 +168,6 @@ public: }; -template < class R_ > -CGAL_KERNEL_INLINE -typename cpp11::result_of ) >::type -Segment_3::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 ) >::type -Segment_3::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, int ) >::type -Segment_3::vertex(int i) const -{ - return (i%2 == 0) ? source() : target(); -} - template < class R > std::ostream & diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index 8e9076b6c3c..246801a068e 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -86,7 +86,7 @@ public: Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const; - typename cpp11::result_of::type + decltype(auto) center() const { return R().construct_center_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index 5916902e060..634e73434da 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -70,13 +70,13 @@ public: t.transform(this->vertex(3))); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); @@ -128,7 +128,7 @@ public: return R().has_on_unbounded_side_3_object()(*this, p); } - typename cpp11::result_of::type + decltype(auto) volume() const { return R().compute_volume_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index 7bd394e10f3..5cc5aa97cad 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace CGAL { @@ -101,13 +100,13 @@ public: return !(*this == t); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 61a310fb5fe..7999ca64f82 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -82,13 +82,13 @@ public: } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this, i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index fed404db54b..8c08dfd29d5 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { @@ -103,26 +102,26 @@ public: } - typename cpp11::result_of::type + decltype(auto) x() const { return R().compute_x_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return R().compute_y_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); return (i==0) ? x() : y(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -138,26 +137,26 @@ public: return typename R::Construct_cartesian_const_iterator_2()(*this,2); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 9304ca4701b..681e3ec7ceb 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { @@ -173,49 +172,49 @@ public: return *this; } - typename cpp11::result_of::type + decltype(auto) x() const { return R().compute_x_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return R().compute_y_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) z() const { return R().compute_z_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -224,7 +223,7 @@ public: return z(); } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 3) ); @@ -239,7 +238,7 @@ public: return 3; } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -255,7 +254,7 @@ public: return typename R::Construct_cartesian_const_iterator_3()(*this,3); } - typename cpp11::result_of::type + decltype(auto) squared_length() const { return R().compute_squared_length_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index d6b05f0fa35..68742e47973 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -24,7 +24,6 @@ #include #include #include -#include #include namespace CGAL { @@ -83,50 +82,50 @@ public: : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y)) {} - typename cpp11::result_of::type + decltype(auto) point() const { return typename R::Construct_point_2()(*this); } - typename cpp11::result_of::type + decltype(auto) weight() const { return typename R::Compute_weight_2()(*this); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_2()(point()); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_2()(point()); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); @@ -143,7 +142,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index fa7e525040c..37aa35f5f4b 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -84,62 +84,62 @@ public: : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z)) {} - typename cpp11::result_of::type + decltype(auto) point() const { return typename R::Construct_point_3()(*this); } - typename cpp11::result_of::type + decltype(auto) weight() const { return typename R::Compute_weight_3()(*this); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_3()(point()); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_3()(point()); } - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_z_3()(point()); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -158,7 +158,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/basic.h b/Kernel_23/include/CGAL/basic.h index 7a9f0a31771..7c6e2768bae 100644 --- a/Kernel_23/include/CGAL/basic.h +++ b/Kernel_23/include/CGAL/basic.h @@ -23,11 +23,6 @@ #include #include -// This cannot be disabled for now until we have a clear idea which -// compilers implement N3276. - -#include - #include #include #include diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_3.h index eb94a85caf6..8e20d4fd2d1 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_3.h @@ -327,8 +327,7 @@ public: //compute intersection points in projected plane //We know that none of the segment is degenerate - typename CGAL::cpp11::result_of::type - o = intersection(s1_2,s2_2); + auto o = intersection(s1_2,s2_2); if(! o){ return boost::none; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h index 92278176ca6..4d2b09ac3b2 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h @@ -17,8 +17,7 @@ template void test_2d(const T1& t1, const T2& t2) { CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(t1, t2); + const auto res1 = CGAL::intersection(t1, t2); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } @@ -26,8 +25,7 @@ template void test_3d(const T1& t1, const T2& t2) { CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(t1, t2); + const auto res1 = CGAL::intersection(t1, t2); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } @@ -112,7 +110,6 @@ void test_linear_intersections() test_3d(triangle_3, triangle_3); CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(plane_3, plane_3, plane_3); + const auto res1 = CGAL::intersection(plane_3, plane_3, plane_3); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } diff --git a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h index f425e157a84..1ac4f08cf2d 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h @@ -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 return type can be obtained through `cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. - +The return type of intersecting two objects of the types `Type1` and `Type2` can be +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.
Type1
Type1 Type2 Return Type: `T...`
- + + @@ -143,13 +145,8 @@ struct Intersection_visitor { template void foo(Segment_d seg, Line_d lin) { - // with C++11 support - // auto result = intersection(seg, lin); - - // without C++11 support - typename cpp11::result_of, Line_d)>::type - result = intersection(seg, lin); - + // use auto + auto result = intersection(seg, lin); if(result) { boost::apply_visitor(Intersection_visitor(), *result); } else { // no intersection } @@ -160,10 +157,10 @@ void foo(Segment_d seg, Line_d lin) \sa `Kernel_d::Intersect_d` \sa `boost::optional` \sa `boost::variant` -\sa `cpp11::result_of` */ -cpp11::result_of, Type2)>::type intersection(Type1 f1, Type2 f2); +decltype(auto) +intersection(Type1 f1, Type2 f2); } /* namespace CGAL */ diff --git a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h index 7d01b176b0c..92f272da256 100644 --- a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h +++ b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h @@ -23,7 +23,7 @@ For a list of the possible return types, see `CGAL::intersection()`. \pre `p` and `q` have the same dimension. */ template -cpp11::result_of::type +decltype(auto) operator()(const Type1& p, const Type2& q); /// @} diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index fb1ca9a5b92..30c46dbc277 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -480,17 +480,14 @@ that are part of flats (`R::Segment_d`, `R::Ray_d`, returns a `boost::optional< boost::variant< T... > >` where `T...` is a list of all possible resulting geometric objects. -The exact result type of an intersection can be determined by using -`cpp11::result_of::%type` -where `Type1` and `Type2` are the types of the objects -used in the intersection computation. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +specified through the placeholder type specifier `auto`. \subsubsection Kernel_dExample Example -In the following example, the object type is used as a return value for -the intersection computation, as there are -possibly different return values. +In the following example, the `auto` is used for the intersection computation, +as there are possibly different return values. \code{.cpp} typedef Cartesian_d K; @@ -500,9 +497,9 @@ typedef Segment_d Segment; Segment s1, s2; std::cin >> s1 >> s2; -cpp11::result_of::type - v = intersection(s1, s2); -if(v) { +// use auto +auto v = intersection(s1, s2); +if (v) { // not empty if (const Point *p = boost::get(&*v) ) { // do something with *p diff --git a/Kernel_d/include/CGAL/intersections_d.h b/Kernel_d/include/CGAL/intersections_d.h index 84697944f78..75607475d94 100644 --- a/Kernel_d/include/CGAL/intersections_d.h +++ b/Kernel_d/include/CGAL/intersections_d.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -typename cpp11::result_of::type +decltype(auto) 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; @@ -46,7 +46,7 @@ intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -75,7 +75,7 @@ intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -99,7 +99,7 @@ intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, c } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -121,12 +121,12 @@ intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k) { return intersection(l,r,k); } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -150,12 +150,12 @@ intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k) { return intersection(r,s, k); } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -179,12 +179,12 @@ intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r) { return intersection(l,s,r); } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -205,12 +205,12 @@ intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, con } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r) { return intersection(l,h,r); } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -231,12 +231,12 @@ intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, cons } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k) { return intersection(r,h,k); } template -typename cpp11::result_of::type +decltype(auto) 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; @@ -258,7 +258,7 @@ intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r) { return intersection(s,h,r); } diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index 6fee6450e2f..ac0f9e1b5b2 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -145,7 +145,6 @@ #include #include #include -#include #include #include diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h index 0fdacdb302c..4d1af263528 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h @@ -312,11 +312,11 @@ public: /*! 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. */ diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 0e4cf7822ab..0dceef7f282 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -590,9 +589,7 @@ public: template Surface_patch clip_to_segment(const Query& query) const { - typename cpp11::result_of::type - clipped = CGAL::intersection(query, r_domain_.bbox_); - + const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) if(const Segment_3* s = boost::get(&*clipped)) return this->operator()(*s); @@ -720,9 +717,7 @@ public: template Intersection clip_to_segment(const Query& query) const { - typename cpp11::result_of::type - clipped = CGAL::intersection(query, r_domain_.bbox_); - + const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) if(const Segment_3* s = boost::get(&*clipped)) return this->operator()(*s); diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h index 6611d928a00..b76e75a8f04 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h @@ -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 // Object is returned as well. template -typename cpp11::result_of< - typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3)>::type +decltype(auto) ts_intersection(const typename K::Triangle_3 &t, const typename K::Segment_3 &s, const K & k) { - typedef typename cpp11::result_of< - typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3) - >::type result_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) result_type; + typedef decltype(typename K::Intersect_3()(s, t)) result_type; CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -399,8 +400,7 @@ ts_intersection(const typename K::Triangle_3 &t, template -typename cpp11::result_of< - typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3)>::type +decltype(auto) tr_intersection(const typename K::Triangle_3 &t, const typename K::Ray_3 &r, 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()(r) ) ; - typedef typename cpp11::result_of< - typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3) - >::type result_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) result_type; + typedef decltype(typename K::Intersect_3()(r, t)) result_type; typedef typename K::Point_3 Point_3; @@ -471,20 +473,12 @@ public: typedef typename K_::Segment_3 Segment_3; typedef typename K_::Ray_3 Ray_3; - template - struct result; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - typedef Exact_predicates_exact_constructions_kernel EK; typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; template - typename cpp11::result_of::type + decltype(auto) operator() (const T1& t, const T2& s) const { // Switch to exact @@ -493,28 +487,32 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - return typename cpp11::result_of::type - (back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); + // typedef decltype( + // std::declval()( + // std::declval(), std::declval())) 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::type + decltype(auto) operator()(const Segment_3& s, const Triangle_3& t) const { return ts_intersection(t, s, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Triangle_3& t, const Segment_3& s) const { return ts_intersection(t, s, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Ray_3& r, const Triangle_3& t) const { return tr_intersection(t, r, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Triangle_3& t, const Ray_3& r) const { return tr_intersection(t, r, K_()); @@ -531,20 +529,12 @@ public: typedef typename K_::Triangle_3 Triangle_3; typedef typename K_::Segment_3 Segment_3; - template - struct result; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - typedef Exact_predicates_exact_constructions_kernel EK; typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; template - typename cpp11::result_of::type + decltype(auto) operator() (const T1& t, const T2& s) const { // Switch to exact @@ -553,8 +543,12 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - return typename cpp11::result_of::type - (back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); + // typedef decltype( + // std::declval()( + // std::declval(), std::declval())) 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)))); } }; diff --git a/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h b/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h index a2a67d32730..1aea65f4fed 100644 --- a/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h +++ b/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h @@ -385,8 +385,6 @@ struct Sizing_field_with_aabb_tree //Compute distance to the curve on which p lies typedef typename GeomTraits::Segment_3 Segment_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 = 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) continue;//don't deal with the same curves as what is done above - Intersection_result int_res - = CGAL::intersection(prim.datum(), curr_ortho_plane); + const auto int_res = CGAL::intersection(prim.datum(), curr_ortho_plane); if (int_res) { if (const Point_3* pp = boost::get(&*int_res)) diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 7b9fbd23f95..ce7d0088fe3 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -439,9 +439,7 @@ public: if(r_domain_.query_is_cached(q)) { const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id(); - typename cpp11::result_of< - typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o - = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q); + const auto o = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q); intersection = o ? Intersection_and_primitive_id(*o, primitive_id) : AABB_intersection(); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index 2064af0b986..3f61fd5ddeb 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -63,7 +63,7 @@ public: typedef C2E To_exact_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; // AP::result_type must be convertible to EP::result_type. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h index d48f3dc7ffc..5f2481695af 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h @@ -134,7 +134,7 @@ typename typeset_intersection(a),Store_kernel2(b){} - // For boost::result_of, used in transforming_iterator + // For the (not anymore used in CGAL) boost result of, used in transforming_iterator template::value?42:0> struct result:Base::template result{}; template struct result { typedef transforming_iterator type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index e9ed67b5393..92e291e53e7 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -127,15 +127,15 @@ template struct Kernel_d_interface : public Base_ { typedef typename Get_functor >::type CPI; typedef typename Get_functor >::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. - //typedef typename CGAL::decay::type>::type result_type; - //typedef typename CGAL::decay::type result_type; - //typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; + // typedef typename CGAL::decay::type>::type result_type; + // typedef typename CGAL::decay::type result_type; + // typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; // HACK typedef typename Base::Point_cartesian_const_iterator result_type; // Kernel_d requires a common iterator type for points and vectors // TODO: provide this mixed functor in preKernel? - //CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); - //CGAL_static_assertion((boost::is_same::type, result_type>::value)); + // CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); + // CGAL_static_assertion((boost::is_same::type, result_type>::value)); template auto operator()(Point_d const&p, Tag_ t)const{ return CPI(this->kernel())(p,t); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 7716c54bf05..f21a7f6b4ba 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -49,7 +49,7 @@ public: typedef Dimension_tag<0> Feature_dimension; typedef typename Get_type::type Rep; - //typedef typename CGAL::decay::type>::type Cartesian_const_iterator; + // typedef typename CGAL::decay::type>::type Cartesian_const_iterator; const Rep& rep() const noexcept { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h index 16174e9a4cb..de13385758d 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace CGAL { namespace Wrap { diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h index 33c956e19cb..f952c9232e8 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h @@ -787,8 +787,7 @@ public: pt, geom_traits().construct_vector_2_object()(pt, ps)); boost::optional Dqt; - typename CGAL::cpp11::result_of::type - result = intersection(lab, lts); + const auto result = intersection(lab, lts); if (result) { const Point* iq = boost::get(&(*result)); diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 27583fe8a15..63ab4c6be9b 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -497,7 +497,7 @@ public: // 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 boost::result_of::type Ret; + typedef decltype(std::declval()(std::declval())) Ret; typedef boost::function_property_map fpmap; typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index 48002f4a7c3..579dc2edede 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -650,7 +649,7 @@ public: // but point() -like functions have return type Point template // can be Point or Point_3 - typename boost::result_of::type + decltype(auto) construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); } diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index d032d7a5ecb..8f0bb97dce1 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -800,9 +800,7 @@ private: double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector())); double angle_B = CGAL_PI - angle_A; - typename cpp11::result_of::type - result = CGAL::intersection(plane1, plane2); - + const auto result = CGAL::intersection(plane1, plane2); if (!result) { #ifdef CGAL_PSP3_VERBOSE @@ -1029,8 +1027,7 @@ private: pts2.push_back (m_points[inde]); } - typename cpp11::result_of::type - result = CGAL::intersection (plane1, ortho); + auto result = CGAL::intersection (plane1, ortho); if (result) { if (const Line* l = boost::get(&*result)) @@ -1194,16 +1191,12 @@ private: const Plane& plane2 = m_planes[m_corners[i].planes[1]]; const Plane& plane3 = m_planes[m_corners[i].planes[2]]; - typename cpp11::result_of::type - result = CGAL::intersection(plane1, plane2); - + const auto result = CGAL::intersection(plane1, plane2); if (result) { if (const Line* l = boost::get(&*result)) { - typename cpp11::result_of::type - result2 = CGAL::intersection(*l, plane3); - + const auto result2 = CGAL::intersection(*l, plane3); if (result2) { if (const Point* p = boost::get(&*result2)) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h index aa91b437311..e262e64ea25 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h @@ -263,9 +263,7 @@ public: p3(to_exact( get(vpm, source(h3,tm)) ), to_exact( get(vpm, target(h3,tm)) ), to_exact( get(vpm, target(next(h3,tm),tm)))); - typename cpp11::result_of< - Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3) - >::type inter_res = exact_intersection(p1, p2, p3); + const auto inter_res = exact_intersection(p1, p2, p3); CGAL_assertion(inter_res != boost::none); const Exact_kernel::Point_3* pt = @@ -389,9 +387,7 @@ public: p3(get(vpm, source(h3,tm)), get(vpm, target(h3,tm)), get(vpm, target(next(h3,tm),tm))); - typename cpp11::result_of< - typename Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3) - >::type inter_res = intersection(p1, p2, p3); + const auto inter_res = intersection(p1, p2, p3); CGAL_assertion(inter_res != boost::none); const Point_3* pt = diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h index f0f65b62ee7..279d85b9ad6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h @@ -83,12 +83,7 @@ bool sorted_around_edge( || coplanar_orientation(o,o_prime,p2,q)==NEGATIVE ); typename Kernel::Orientation_3 orientation; - typedef typename Kernel::Point_3 Point_3; - 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); + const auto s0 = orientation(o_prime, o, p1, p2); if ( s0==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 - Orientation s1 = orientation(o_prime, o, p1, q); - Orientation s2 = orientation(o_prime, o, q , p2); + const auto s1 = orientation(o_prime, o, p1, q); + const auto s2 = orientation(o_prime, o, q , p2); if (s0 == POSITIVE) // the angle p1,o,p2 is smaller that Pi. return ( s1 == POSITIVE ) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h index 499ed2506a4..9c80a2e630a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h @@ -276,8 +276,7 @@ class Polygon_mesh_slicer get(m_vpmap, source(ed, m_tmesh)), get(m_vpmap,target(ed, m_tmesh)) ); - typename cpp11::result_of::type - inter = intersect_3(m_plane, s); + const auto inter = intersect_3(m_plane, s); CGAL_assertion(inter != boost::none); const Point_3* pt_ptr = boost::get(&(*inter)); current_poly.push_back( *pt_ptr ); diff --git a/STL_Extension/doc/STL_Extension/CGAL/result_of.h b/STL_Extension/doc/STL_Extension/CGAL/result_of.h index e39e27c35f3..507efb3645c 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/result_of.h +++ b/STL_Extension/doc/STL_Extension/CGAL/result_of.h @@ -3,16 +3,18 @@ namespace cpp11 { /*! \ingroup PkgSTLExtensionRef - Alias to the tr1 implementation from boost of the `result_of` mechanism. - When all compilers supported by %CGAL will have a Standard compliant implemention of the - the \cpp11 `decltype` feature, it will become an alias to std::result_of. + Alias to the implementation of the `std::result_of` mechanism. When all compilers + supported by \cgal have a Standard compliant implemention of the `std::invoke_result` + mechanism, it will become an alias to the std::invoke_result. - \sa boost::result_of + \sa std::result_of */ template - struct result_of{ - /// starting from boost version 1.44, it is `boost::tr1_result_of::%type`, and - /// `boost::result_of::%type` otherwise. + struct result_of { + + /*! + It is a type `std::result_of::%type`. + */ typedef unspecified_type type; }; diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index ea2b445b6f5..8395606f4b5 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -660,7 +659,8 @@ class Join_input_iterator_1 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef std::decay_t::type> value_type; + typedef std::decay_t()(std::declval()))> + value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type const* pointer; typedef value_type const& reference; @@ -746,7 +746,8 @@ class Join_input_iterator_2 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef typename cpp11::result_of::type value_type; + typedef decltype(std::declval()(std::declval(), std::declval())) + value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; typedef value_type& reference; @@ -840,7 +841,7 @@ class Join_input_iterator_3 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef typename cpp11::result_of::type + typedef decltype(std::declval()(std::declval(), std::declval(), std::declval())) value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; diff --git a/STL_Extension/include/CGAL/result_of.h b/STL_Extension/include/CGAL/result_of.h index 337344bc328..863ddb90806 100644 --- a/STL_Extension/include/CGAL/result_of.h +++ b/STL_Extension/include/CGAL/result_of.h @@ -21,42 +21,53 @@ #include #include -// Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' -// 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 -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L -#include + // C++>=17 -namespace CGAL{ +#elif CGAL_CXX11 -// Even if for now we use the tr1 result_of implementation, we use the cpp11 -// namespace since in the future, that's the decltype version that will be used -namespace cpp11{ + #include -template -struct result_of -{ - // from boost 1.44 release note https://www.boost.org/users/history/version_1_44_0.html : - // New template boost::tr1_result_of that implements the TR1 ResultOf protocol even if boost::result_of uses the C++0x decltype-based implementation. - #if BOOST_VERSION < 104400 - typedef typename boost::result_of::type type; - #else - typedef typename boost::tr1_result_of::type type; +#else // C++<11 + + // Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' + // 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 + #if defined(BOOST_MSVC) + #pragma warning(pop) + #endif + #include -} +#endif // end C++<11 -} +namespace CGAL { +namespace cpp11 { + +#if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L + + template class result_of; + template + class result_of : public std::invoke_result { }; + +#elif CGAL_CXX11 + + using std::result_of; + +#else // C++<11 + + using boost::result_of; + +#endif // end C++<11 + +} // end cpp11 +} // end CGAL #include -#endif //CGAL_RESULT_OF_H +#endif // CGAL_RESULT_OF_H diff --git a/STL_Extension/include/CGAL/transforming_iterator.h b/STL_Extension/include/CGAL/transforming_iterator.h index 16bf7649da5..c77e36669fa 100644 --- a/STL_Extension/include/CGAL/transforming_iterator.h +++ b/STL_Extension/include/CGAL/transforming_iterator.h @@ -12,7 +12,6 @@ #ifndef CGAL_TRANSFORMING_ITERATOR_H #define CGAL_TRANSFORMING_ITERATOR_H #include -#include #include #include #include diff --git a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h index 811ad3de64c..ff38140189c 100644 --- a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h +++ b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h @@ -152,7 +152,7 @@ public: /*! Function object type. Must provide - `CGAL::cpp11::result_of::%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 `Line_2`, `Ray_2`, `Segment_2`. */ diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index dc68794302b..ef841dd6bb3 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -977,8 +977,6 @@ private: 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()); - typedef typename cpp11::result_of::type LineLineIntersectResult; - Point_2 leftPoint; Point_2 rightPoint; @@ -1003,7 +1001,7 @@ private: } else { - LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); + const auto cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); if (!cgalIntersection || !boost::get(&*cgalIntersection)) { @@ -1015,7 +1013,7 @@ private: } else { - Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = boost::get(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); if (t0 >= FT(1)) @@ -1061,7 +1059,7 @@ private: } else { - LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); + const auto cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); if (!cgalIntersection || !boost::get(&*cgalIntersection)) { @@ -1073,7 +1071,7 @@ private: } else { - Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = boost::get(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); 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::Intersect_2 intersect_2(m_traits.intersect_2_object()); - typedef typename cpp11::result_of::type LineLineIntersectResult; - Cone_tree_node* current = startNode; Point_2 currentLocation(startLocation); @@ -1713,7 +1709,7 @@ private: const Point_2& currentSourceImage = current->source_image(); 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)); diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h index b637938b366..6dd44eec600 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -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 { - typedef typename CGAL::cpp11::result_of::type LineLineIntersectResult; - Line_2 s1Line(m_construct_line_2(s1)); 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)); 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(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)); if (!intersectResult2) return CGAL::SMALLER;
Type1
Type1 Type2 `T...`