diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 8ff12dfe862..07bdad7d520 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include 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 b2326adedd4..beecb4c1dba 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 @@ -518,22 +518,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); } @@ -643,21 +629,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 ) { @@ -1292,20 +1263,6 @@ 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 decltype(std::declval()(Circle_2())) type; - }; - - template - struct result { - typedef decltype(std::declval()(Circle_2())) type; - }; decltype(auto) operator()( const Circle_2& c) const 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 694705639c3..7ab1bd49b97 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 @@ -667,15 +667,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, @@ -1168,44 +1159,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/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 7ae3bcb36fe..f348718c544 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -817,20 +817,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 < \ - decltype(std::declval()(BOOST_PP_ENUM(n, CGAL_PARAM, E))) >::type >::type > type; \ - }; - - BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _) - template auto operator()(L const&...l) const -> Lazy_exact_nt>> @@ -847,8 +833,6 @@ struct Lazy_construction_nt { return new Lazy_rep_0 >(ec( CGAL::exact(l)... )); } } - -#undef CGAL_RESULT_NT }; diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 740fe435f9e..5892d511db3 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()(A(), B()))(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()(A(), B()))(); } // 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 f836dbd6aea..b8c1b77dad8 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/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index c3c3537838e..41e978b703b 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2557,15 +2557,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 @@ -3516,17 +3507,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()); } }; @@ -3536,21 +3520,6 @@ 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 @@ -3558,7 +3527,7 @@ namespace CommonKernelFunctors { 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() ); } };