mirror of https://github.com/CGAL/cgal
further removed result_of and result
This commit is contained in:
parent
2f7f37983b
commit
ad813b4cb0
|
|
@ -24,6 +24,7 @@
|
|||
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
|
||||
#include <CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h>
|
||||
#include <CGAL/internal/AABB_tree/Primitive_helper.h>
|
||||
#include <CGAL/result_of.h>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
|
|
|||
|
|
@ -518,22 +518,8 @@ namespace CircularFunctors {
|
|||
|
||||
//using CK::Linear_kernel::Intersect_2::operator();
|
||||
|
||||
template<typename>
|
||||
struct result;
|
||||
|
||||
template<typename F, typename A, typename B>
|
||||
struct result<F(A,B)> {
|
||||
typedef typename Intersection_traits<CK, A, B>::result_type type;
|
||||
};
|
||||
|
||||
//need a specialization for the case of 3 object in CK
|
||||
template<typename F, typename A, typename B, typename OutputIterator>
|
||||
struct result<F(A,B,OutputIterator)> {
|
||||
typedef OutputIterator type;
|
||||
};
|
||||
|
||||
template<class A, class B>
|
||||
typename Intersection_traits<CK, A, B>::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<typename>
|
||||
struct result;
|
||||
|
||||
template<typename F>
|
||||
struct result<F(typename CK::Line_2)>
|
||||
{
|
||||
typedef typename CK::Polynomial_1_2 type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(typename CK::Circle_2)>
|
||||
{
|
||||
typedef typename CK::Polynomial_for_circles_2_2 type;
|
||||
};
|
||||
|
||||
typename CK::Polynomial_1_2
|
||||
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<typename>
|
||||
struct result{
|
||||
typedef FT type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Circular_arc_2)> {
|
||||
typedef decltype(std::declval<LK_Compute_squared_radius_2>()(Circle_2())) type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Circle_2)> {
|
||||
typedef decltype(std::declval<LK_Compute_squared_radius_2>()(Circle_2())) type;
|
||||
};
|
||||
|
||||
decltype(auto)
|
||||
operator()( const Circle_2& c) const
|
||||
|
|
|
|||
|
|
@ -667,15 +667,6 @@ template < class SK > \
|
|||
typedef typename SK::Kernel_base::Circle_3 RCircle_3;
|
||||
typedef typename Circle_3::Rep Rep;
|
||||
public:
|
||||
template<typename>
|
||||
struct result {
|
||||
typedef forwarded_result_type type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Circular_arc_3)> {
|
||||
typedef const forwarded_result_type& type;
|
||||
};
|
||||
|
||||
forwarded_result_type
|
||||
operator()(const Point_3& p, const FT& sr,
|
||||
|
|
@ -1168,44 +1159,17 @@ template < class SK > \
|
|||
|
||||
public:
|
||||
|
||||
template <typename>
|
||||
struct result;
|
||||
|
||||
// the binary overload always goes to Linear::Intersect_3
|
||||
template <typename F, typename A, typename B>
|
||||
struct result<F(A, B)>
|
||||
{ typedef typename Intersection_traits<SK, A, B>::result_type type; };
|
||||
|
||||
// This one is only for the spherical kernel, O is an output iterator
|
||||
template <typename F, typename A, typename B, typename OutputIterator>
|
||||
struct result<F(A, B, OutputIterator)>
|
||||
{ typedef OutputIterator type;};
|
||||
|
||||
// there is no quaternary form in the linear Kernel
|
||||
template <typename F, typename A, typename B, typename C, typename OutputIterator>
|
||||
struct result<F(A, B, C, OutputIterator)>
|
||||
{ typedef OutputIterator type; };
|
||||
|
||||
//only ternary from the linear kernel
|
||||
template<typename F>
|
||||
struct result<F(Plane_3, Plane_3, Plane_3)> {
|
||||
typedef boost::optional<
|
||||
boost::variant< Point_3,
|
||||
Line_3,
|
||||
Plane_3 > > type;
|
||||
};
|
||||
|
||||
//using SK::Linear_kernel::Intersect_3::operator();
|
||||
|
||||
typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3;
|
||||
|
||||
template<class A, class B>
|
||||
typename Intersection_traits<SK, A, B>::result_type
|
||||
decltype(auto)
|
||||
operator()(const A& a, const B& b) const{
|
||||
return Intersect_linear_3()(a,b);
|
||||
}
|
||||
|
||||
typename result<Intersect_linear_3(Plane_3, Plane_3, Plane_3)>::type
|
||||
decltype(auto)
|
||||
operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const
|
||||
{
|
||||
return Intersect_linear_3()(p, q, r);
|
||||
|
|
|
|||
|
|
@ -41,33 +41,6 @@ namespace CGAL {
|
|||
typedef typename SK::Polynomials_for_circle_3 result_type_for_circle;
|
||||
//using LinearFunctors::Get_equation<SK>::operator();
|
||||
|
||||
template <typename>
|
||||
struct result;
|
||||
|
||||
template <typename F>
|
||||
struct result<F(typename SK::Sphere_3)>
|
||||
{
|
||||
typedef result_type_for_sphere type;
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
struct result<F(typename SK::Plane_3)>
|
||||
{
|
||||
typedef result_type_for_plane type;
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
struct result<F(typename SK::Line_3)>
|
||||
{
|
||||
typedef result_type_for_line type;
|
||||
};
|
||||
|
||||
template <typename F>
|
||||
struct result<F(typename SK::Circle_3)>
|
||||
{
|
||||
typedef result_type_for_circle type;
|
||||
};
|
||||
|
||||
result_type_for_sphere
|
||||
operator() ( const typename SK::Sphere_3 & s )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -817,20 +817,6 @@ struct Lazy_construction_nt {
|
|||
CGAL_NO_UNIQUE_ADDRESS AC ac;
|
||||
CGAL_NO_UNIQUE_ADDRESS EC ec;
|
||||
|
||||
template<typename>
|
||||
struct result { };
|
||||
|
||||
#define CGAL_RESULT_NT(z, n, d) \
|
||||
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
|
||||
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
|
||||
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \
|
||||
typedef Lazy_exact_nt< \
|
||||
typename boost::remove_cv< typename boost::remove_reference < \
|
||||
decltype(std::declval<EC>()(BOOST_PP_ENUM(n, CGAL_PARAM, E))) >::type >::type > type; \
|
||||
};
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _)
|
||||
|
||||
template<class...L>
|
||||
auto operator()(L const&...l) const ->
|
||||
Lazy_exact_nt<std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>>>
|
||||
|
|
@ -847,8 +833,6 @@ struct Lazy_construction_nt {
|
|||
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( CGAL::exact(l)... ));
|
||||
}
|
||||
}
|
||||
|
||||
#undef CGAL_RESULT_NT
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <CGAL/Object.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#include <CGAL/result_of.h>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
|
@ -41,13 +40,13 @@
|
|||
#define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \
|
||||
template<typename K> \
|
||||
inline \
|
||||
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \
|
||||
decltype(auto) \
|
||||
intersection(const A<K>& a, const B<K>& b) { \
|
||||
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
|
||||
} \
|
||||
template<typename K> \
|
||||
inline \
|
||||
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \
|
||||
decltype(auto) \
|
||||
intersection(const B<K>& a, const A<K>& b) { \
|
||||
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<typename K> \
|
||||
inline \
|
||||
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::A)>::type \
|
||||
decltype(auto) \
|
||||
intersection(const A<K> & a, const A<K> & b) { \
|
||||
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<typename F, typename A, typename B, typename T>
|
||||
inline typename cpp11::result_of<F(A, B)>::type
|
||||
intersection_return(T&& t) { return typename cpp11::result_of<F(A, B)>::type(std::forward<T>(t)); }
|
||||
decltype(auto)
|
||||
intersection_return(T&& t) { return decltype(std::declval<F>()(A(), B()))(std::forward<T>(t)); }
|
||||
template<typename F, typename A, typename B>
|
||||
inline typename cpp11::result_of<F(A, B)>::type
|
||||
intersection_return() { return typename cpp11::result_of<F(A, B)>::type(); }
|
||||
decltype(auto)
|
||||
intersection_return() { return decltype(std::declval<F>()(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<BOOST_VARIANT_ENUM_PARAMS(U)> & v) {
|
|||
}
|
||||
|
||||
template<typename A, typename B>
|
||||
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_2(A, B)>::type
|
||||
decltype(auto)
|
||||
intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) {
|
||||
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
|
||||
return Kernel().intersect_2_object()(a, b);
|
||||
}
|
||||
|
||||
template<typename A, typename B>
|
||||
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_3(A, B)>::type
|
||||
decltype(auto)
|
||||
intersection_impl(const A& a, const B& b, Dimension_tag<3>) {
|
||||
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
|
||||
return Kernel().intersect_3_object()(a, b);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace CGAL {
|
|||
// the special plane_3 function
|
||||
template <class K>
|
||||
inline
|
||||
typename cpp11::result_of<typename K::Intersect_3(typename K::Plane_3, typename K::Plane_3, typename K::Plane_3)>::type
|
||||
decltype(auto)
|
||||
intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2,
|
||||
const Plane_3<K> &plane3)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2557,15 +2557,6 @@ namespace CommonKernelFunctors {
|
|||
typedef typename K::Triangle_3 Triangle_3;
|
||||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
public:
|
||||
template<typename>
|
||||
struct result {
|
||||
typedef const Point_3& type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct result<T(Iso_cuboid_3, int)> {
|
||||
typedef Point_3 type;
|
||||
};
|
||||
|
||||
const Point_3&
|
||||
operator()( const Segment_3& s, int i) const
|
||||
|
|
@ -3516,17 +3507,10 @@ namespace CommonKernelFunctors {
|
|||
class Intersect_2
|
||||
{
|
||||
public:
|
||||
template<typename>
|
||||
struct result;
|
||||
|
||||
template<typename F, typename A, typename B>
|
||||
struct result<F(A,B)> {
|
||||
typedef typename Intersection_traits<K, A, B>::result_type type;
|
||||
};
|
||||
|
||||
// 25 possibilities, so I keep the template.
|
||||
template <class T1, class T2>
|
||||
typename Intersection_traits<K, T1, T2>::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<typename>
|
||||
struct result;
|
||||
|
||||
template<typename F, typename A, typename B>
|
||||
struct result<F(A, B)> {
|
||||
typedef typename Intersection_traits<K, A, B>::result_type type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Plane_3, Plane_3, Plane_3)> {
|
||||
typedef boost::optional<
|
||||
boost::variant< typename K::Point_3,
|
||||
typename K::Line_3,
|
||||
typename K::Plane_3 > > type;
|
||||
};
|
||||
|
||||
// n possibilities, so I keep the template.
|
||||
template <class T1, class T2>
|
||||
|
|
@ -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() ); }
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue