* Using result_of instead of Qualified_result_of

* limited refactoring in the lazy kernel
* still bugs in circular_3
* still specialization problem with iso_rectangle
This commit is contained in:
Philipp Möller 2011-11-23 17:52:38 +00:00
parent 2672fabe10
commit 0e0a200646
38 changed files with 836 additions and 1426 deletions

View File

@ -988,36 +988,35 @@ namespace CartesianKernelFunctors {
typedef typename K::Point_2 Point_2;
typedef typename K::Circle_2 Circle_2;
public:
typedef FT result_type;
template<class>
struct result {
typedef FT type;
};
const result_type&
template<typename F>
struct result<F(Circle_2)> {
typedef const FT& type;
};
const FT&
operator()( const Circle_2& c) const
{ return c.rep().squared_radius(); }
result_type
FT
operator()( const Point_2& /*p*/) const
{ return FT(0); }
result_type
FT
operator()( const Point_2& p, const Point_2& q) const
{ return squared_radiusC2(p.x(), p.y(), q.x(), q.y()); }
result_type
FT
operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
{ return squared_radiusC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y()); }
};
} //namespace CartesianKernelFunctors
#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCH
template < typename K>
struct Qualified_result_of<CartesianKernelFunctors::Compute_squared_radius_2<K>,
typename K::Circle_2>
{
typedef typename K::FT const & type;
};
#endif
// For the non specialized template will do the right thing,
// namely return a copy of an FT
@ -1104,22 +1103,22 @@ namespace CartesianKernelFunctors {
template <typename K>
class Compute_x_2 : Has_qrt
class Compute_x_2
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Vector_2 Vector_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().x();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().x();
@ -1127,22 +1126,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_x_3 : Has_qrt
class Compute_x_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().x();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().x();
@ -1151,22 +1150,22 @@ namespace CartesianKernelFunctors {
template <typename K>
class Compute_y_2 : Has_qrt
class Compute_y_2
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Vector_2 Vector_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().y();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().y();
@ -1175,22 +1174,22 @@ namespace CartesianKernelFunctors {
template <typename K>
class Compute_y_3 : Has_qrt
class Compute_y_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().y();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().y();
@ -1198,22 +1197,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_z_3 : Has_qrt
class Compute_z_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().z();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().z();
@ -1223,15 +1222,15 @@ namespace CartesianKernelFunctors {
template <typename K>
class Compute_dx_2 : public Has_qrt
class Compute_dx_2
{
typedef typename K::FT FT;
typedef typename K::Direction_2 Direction_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Direction_2& d) const
{
return d.rep().dx();
@ -1239,15 +1238,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_dx_3 : public Has_qrt
class Compute_dx_3
{
typedef typename K::FT FT;
typedef typename K::Direction_3 Direction_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dx();
@ -1255,15 +1254,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_dy_2 : public Has_qrt
class Compute_dy_2
{
typedef typename K::FT FT;
typedef typename K::Direction_2 Direction_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Direction_2& d) const
{
return d.rep().dy();
@ -1271,15 +1270,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_dy_3 : public Has_qrt
class Compute_dy_3
{
typedef typename K::FT FT;
typedef typename K::Direction_3 Direction_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dy();
@ -1287,15 +1286,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_dz_3 : public Has_qrt
class Compute_dz_3
{
typedef typename K::FT FT;
typedef typename K::Direction_3 Direction_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dz();
@ -1303,22 +1302,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hx_2 : public Has_qrt
class Compute_hx_2
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Vector_2 Vector_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hx();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hx();
@ -1326,22 +1325,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hx_3 : public Has_qrt
class Compute_hx_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hx();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hx();
@ -1349,22 +1348,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hy_2 : public Has_qrt
class Compute_hy_2
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Vector_2 Vector_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hy();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hy();
@ -1372,22 +1371,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hy_3 : public Has_qrt
class Compute_hy_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hy();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hy();
@ -1395,22 +1394,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hz_3 : public Has_qrt
class Compute_hz_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hz();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hz();
@ -1418,22 +1417,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hw_2 : public Has_qrt
class Compute_hw_2
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point_2;
typedef typename K::Vector_2 Vector_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hw();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hw();
@ -1441,22 +1440,22 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_hw_3 : public Has_qrt
class Compute_hw_3
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hw();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hw();
@ -1465,15 +1464,15 @@ namespace CartesianKernelFunctors {
template <typename K>
class Compute_xmin_2 : public Has_qrt
class Compute_xmin_2
{
typedef typename K::FT FT;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Iso_rectangle_2& r) const
{
return (r.min)().x();
@ -1481,15 +1480,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_xmax_2 : public Has_qrt
class Compute_xmax_2
{
typedef typename K::FT FT;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Iso_rectangle_2& r) const
{
return (r.max)().x();
@ -1497,15 +1496,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_ymin_2 : public Has_qrt
class Compute_ymin_2
{
typedef typename K::FT FT;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Iso_rectangle_2& r) const
{
return (r.min)().y();
@ -1513,15 +1512,15 @@ namespace CartesianKernelFunctors {
};
template <typename K>
class Compute_ymax_2 : public Has_qrt
class Compute_ymax_2
{
typedef typename K::FT FT;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef FT result_type;
typedef const FT& result_type;
const result_type &
result_type
operator()(const Iso_rectangle_2& r) const
{
return (r.max)().y();
@ -3346,7 +3345,15 @@ namespace CartesianKernelFunctors {
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
typedef typename K::Triangle_2 Triangle_2;
public:
typedef Point_2 result_type;
template<class>
struct result {
typedef const Point_2& type;
};
template<typename F>
struct result<F(Iso_rectangle_2, int)> {
typedef Point_2 type;
};
const Point_2 &
operator()( const Segment_2& s, int i) const
@ -3370,22 +3377,6 @@ namespace CartesianKernelFunctors {
} //namespace CartesianKernelFunctors
#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCH
template < typename K>
struct Qualified_result_of<CartesianKernelFunctors::Construct_vertex_2<K>, typename K::Segment_2, int >
{
typedef typename K::Point_2 const & type;
};
template < typename K>
struct Qualified_result_of<CartesianKernelFunctors::Construct_vertex_2<K>, typename K::Triangle_2, int >
{
typedef typename K::Point_2 const & type;
};
#endif
// For Iso_rectangle the non specialized template will do the right thing, namely return a copy of a point
namespace CartesianKernelFunctors {
template <typename K>

View File

@ -109,33 +109,25 @@ public:
{}
typename Qualified_result_of
<typename R::Construct_circular_source_vertex_2,Circular_arc_2>::type
//const Circular_arc_point_2 &
typename boost::result_of<typename R::Construct_circular_source_vertex_2(Circular_arc_2)>::type
source() const
{
return typename R::Construct_circular_source_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_target_vertex_2,Circular_arc_2>::type
//const Circular_arc_point_2 &
typename boost::result_of<typename R::Construct_circular_target_vertex_2(Circular_arc_2)>::type
target() const
{
return typename R::Construct_circular_target_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_min_vertex_2,Circular_arc_2>::type
//const Circular_arc_point_2 &
typename boost::result_of<typename R::Construct_circular_min_vertex_2(Circular_arc_2)>::type
left() const
{
return typename R::Construct_circular_min_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_max_vertex_2,Circular_arc_2>::type
//const Circular_arc_point_2 &
typename boost::result_of<typename R::Construct_circular_max_vertex_2(Circular_arc_2)>::type
right() const
{
return typename R::Construct_circular_max_vertex_2()(*this);
@ -151,25 +143,19 @@ public:
return typename R::Is_y_monotone_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circle_2,Circular_arc_2>::type
// const Circle_2 &
typename boost::result_of<typename R::Construct_circle_2(Circular_arc_2)>::type
supporting_circle() const
{
return typename R::Construct_circle_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_center_2,Circular_arc_2>::type
// const Point_2 &
typename boost::result_of<typename R::Construct_center_2(Circular_arc_2)>::type
center() const
{
return typename R::Construct_center_2()(*this);
}
typename Qualified_result_of
<typename R::Compute_squared_radius_2, Circular_arc_2>::type
// const FT &
typename boost::result_of<typename R::Compute_squared_radius_2( Circular_arc_2)>::type
squared_radius() const
{
return typename R::Compute_squared_radius_2()(*this);

View File

@ -25,6 +25,8 @@
#ifndef CGAL_CIRCULAR_ARC_POINT_2_H
#define CGAL_CIRCULAR_ARC_POINT_2_H
#include <boost/utility/result_of.hpp>
namespace CGAL {
template < typename CircularKernel >
@ -72,17 +74,15 @@ public:
: RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p))
{}
typename Qualified_result_of
<typename R::Compute_circular_x_2,Circular_arc_point_2>::type
//const Root_of_2 &
typename
boost::result_of<R::Compute_circular_x_2(Circular_arc_point_2)>::type
x() const
{
return typename R::Compute_circular_x_2()(*this);
}
typename Qualified_result_of
<typename R::Compute_circular_y_2,Circular_arc_point_2>::type
//const Root_of_2 &
typename
boost::result_of<R::Compute_circular_y_2(Circular_arc_point_2)>::type
y() const
{
return typename R::Compute_circular_y_2()(*this);

View File

@ -37,23 +37,72 @@ namespace CircularFunctors {
template < class CK >
class Construct_circle_2 : public CK::Linear_kernel::Construct_circle_2
{
CK::Linear_kernel::Construct_circle_2 Base_functor;
typedef typename CK::Linear_kernel::Construct_circle_2::result_type
forwarded_result_type;
typedef typename CK::FT FT;
typedef typename CK::Linear_kernel::Point_2 Point_2;
public:
Construct_circle_2() : Base_functor(CK().construct_circle_2_object()) {}
template<class>
struct result {
// all forwarded smoothly
typedef forwarded_result_type type;
};
template<typename F>
struct result<F(Circular_arc_2)> {
// this one returns a reference
typedef const forwared_result_type& type;
};
// forward the functors from Base_functor
forwarded_result_type
operator()( const Point_2& center, const FT& squared_radius,
Orientation orientation = COUNTERCLOCKWISE) const
{
return Base_functor(center, squared_radius, orientation);
}
forwarded_result_type
operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
{
return Base_functor(p, q, r);
}
forwarded_result_type
operator()( const Point_2& p, const Point_2& q,
Orientation orientation = COUNTERCLOCKWISE) const
{
return Base_functor(p, q, orientation);
}
forwarded_result_type
operator()( const Point_2& p, const Point_2& q,
const FT& bulge) const
{
return Base_functor(p, q, bulge);
}
forwarded_result_type
operator()( const Point_2& center,
Orientation orientation = COUNTERCLOCKWISE) const
{
return Base_functor(center, orientation);
}
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Linear_kernel::Construct_circle_2::result_type
result_type;
using CK::Linear_kernel::Construct_circle_2::operator();
result_type
operator() ( const typename CK::Polynomial_for_circles_2_2 &eq )
{
operator() ( const typename CK::Polynomial_for_circles_2_2 &eq ) {
return construct_circle_2<CK>(eq);
}
const result_type&
operator() (const Circular_arc_2 & a) const
{
operator() (const Circular_arc_2 & a) const {
return (a.rep().supporting_circle());
}
@ -61,15 +110,6 @@ namespace CircularFunctors {
} // namespace CircularFunctors
#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCH
template < typename K>
struct Qualified_result_of<CircularFunctors::Construct_circle_2<K>,
typename K::Circular_arc_2>
{
typedef const typename K::Circle_2 & type;
};
#endif
} // namespace CGAL
#endif // CGAL_CIRCULAR_KERNEL_FUNCTION_OBJECTS_ON_CIRCLE_2_H

View File

@ -829,17 +829,15 @@ namespace CircularFunctors {
template <class CK>
class Compute_circular_x_2: Has_qrt
class Compute_circular_x_2
{
typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;
typedef typename CK::Root_of_2 Root_of_2;
public:
typedef const Root_of_2& result_type;
typedef Root_of_2 result_type;
typedef const result_type & qualified_result_type;
qualified_result_type operator() (const Circular_arc_point_2 & a) const
result_type operator() (const Circular_arc_point_2 & a) const
{
return (a.rep().x());
}
@ -847,17 +845,16 @@ namespace CircularFunctors {
template <class CK>
class Compute_circular_y_2: Has_qrt
class Compute_circular_y_2
{
typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;
typedef typename CK::Root_of_2 Root_of_2;
public:
typedef Root_of_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Root_of_2& result_type;
qualified_result_type operator() (const Circular_arc_point_2 & a) const
result_type operator() (const Circular_arc_point_2 & a) const
{
return (a.rep().y());
}
@ -865,27 +862,21 @@ namespace CircularFunctors {
template <class CK>
class Construct_circular_min_vertex_2 : Has_qrt
class Construct_circular_min_vertex_2
{
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Line_arc_2 Line_arc_2;
typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;
public:
typedef const Circular_arc_point_2 & result_type;
typedef Circular_arc_point_2 result_type;
typedef const result_type & qualified_result_type;
qualified_result_type operator() (const Circular_arc_2 & a) const
result_type operator() (const Circular_arc_2 & a) const
{
// if (a.rep().Cache_minmax == 't')
// return (a.rep().source());
// if (a.rep().Cache_minmax == 's')
// return (a.rep().target());
return (a.rep().left());
}
qualified_result_type operator() (const Line_arc_2 & a) const
result_type operator() (const Line_arc_2 & a) const
{
return (a.rep().left());
}
@ -893,7 +884,7 @@ namespace CircularFunctors {
};
template <class CK>
class Construct_circular_max_vertex_2: Has_qrt
class Construct_circular_max_vertex_2
{
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Line_arc_2 Line_arc_2;
@ -901,19 +892,14 @@ namespace CircularFunctors {
public:
typedef Circular_arc_point_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_2& result_type;
qualified_result_type operator() (const Circular_arc_2 & a) const
result_type operator() (const Circular_arc_2 & a) const
{
// if (a.rep().Cache_minmax == 's')
// return (a.rep().source());
// if (a.rep().Cache_minmax == 't')
// return (a.rep().target());
return (a.rep().right());
}
qualified_result_type operator() (const Line_arc_2 & a) const
result_type operator() (const Line_arc_2 & a) const
{
return (a.rep().right());
}
@ -921,7 +907,7 @@ namespace CircularFunctors {
};
template <class CK>
class Construct_circular_source_vertex_2: Has_qrt
class Construct_circular_source_vertex_2
{
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Line_arc_2 Line_arc_2;
@ -929,20 +915,19 @@ namespace CircularFunctors {
public:
typedef Circular_arc_point_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_2& result_type;
qualified_result_type operator() (const Circular_arc_2 & a) const
result_type operator() (const Circular_arc_2 & a) const
{ return a.rep().source(); }
qualified_result_type operator() (const Line_arc_2 & a) const
result_type operator() (const Line_arc_2 & a) const
{ return a.rep().source();}
};
template <class CK>
class Construct_circular_target_vertex_2: Has_qrt
class Construct_circular_target_vertex_2
{
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Line_arc_2 Line_arc_2;
@ -950,13 +935,12 @@ namespace CircularFunctors {
public:
typedef Circular_arc_point_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_2& result_type;
qualified_result_type operator() (const Circular_arc_2 & a) const
result_type operator() (const Circular_arc_2 & a) const
{ return a.rep().target();}
qualified_result_type operator() (const Line_arc_2 & a) const
result_type operator() (const Line_arc_2 & a) const
{ return a.rep().target();}
};
@ -1194,7 +1178,7 @@ namespace CircularFunctors {
#ifndef CGAL_NO_DEPRECATED_CODE
template <class CK>
class Construct_supporting_circle_2: Has_qrt
class Construct_supporting_circle_2
{
typedef typename CK::Circular_arc_2 Circular_arc_2;
typedef typename CK::Circle_2 Circle_2;
@ -1211,7 +1195,7 @@ namespace CircularFunctors {
template <class CK>
class Construct_supporting_line_2: Has_qrt
class Construct_supporting_line_2
{
typedef typename CK::Line_arc_2 Line_arc_2;
typedef typename CK::Line_2 Line_2;
@ -1232,15 +1216,12 @@ namespace CircularFunctors {
class Construct_center_2
#ifndef CGAL_CFG_MATCHING_BUG_6
: public CK::Linear_kernel::Construct_center_2
#else
: public Has_qrt
#endif
{
typedef typename CK::Linear_kernel::Construct_center_2::result_type result_type;
typedef typename CK::Circular_arc_2 Circular_arc_2;
public:
#ifndef CGAL_CFG_MATCHING_BUG_6
typedef typename CK::Linear_kernel::Construct_center_2::result_type result_type;
using CK::Linear_kernel::Construct_center_2::operator();
#else
@ -1248,16 +1229,15 @@ namespace CircularFunctors {
typedef typename LK::Construct_center_2 LK_Construct_center_2;
typedef typename CK::Point_2 Point_2;
typedef typename CK::Circle_2 Circle_2;
public:
typedef Point_2 result_type;
const result_type&
public:
result_type
operator()( const Circle_2& c) const
{ return LK_Construct_center_2()(c); }
#endif
const result_type&
result_type
operator()(const Circular_arc_2& c) const
{ return c.rep().center(); }
@ -1265,75 +1245,55 @@ namespace CircularFunctors {
template <typename CK>
class Compute_squared_radius_2
#ifndef CGAL_CFG_MATCHING_BUG_6
: public CK::Linear_kernel::Compute_squared_radius_2
#endif
{
private:
typedef typename CK::Circular_arc_2 Circular_arc_2;
public:
#ifndef CGAL_CFG_MATCHING_BUG_6
typedef typename CK::Linear_kernel::Compute_squared_radius_2::result_type result_type;
using CK::Linear_kernel::Compute_squared_radius_2::operator();
#else
typedef typename CK::Linear_kernel LK;
typedef typename LK::Compute_squared_radius_2 LK_Compute_squared_radius_2;
typedef typename CK::FT FT;
typedef typename CK::Point_2 Point_2;
typedef typename CK::Circle_2 Circle_2;
typedef FT forwarded_result_type;
public:
typedef FT result_type;
template<typename>
struct result {
typedef forwarded_result_type type;
};
const result_type&
template<typename F>
struct result<F(Circular_arc_2)> {
typedef const forwarded_result_type& type;
};
template<typename F>
struct result<F(Circle_2)> {
typedef const forwarded_result_type& type;
};
const forwarded_result_type&
operator()( const Circle_2& c) const
{ return LK_Compute_squared_radius_2()(c); }
result_type
forwarded_result_type
operator()( const Point_2& p) const
{ return LK_Compute_squared_radius_2()(p); }
result_type
forwarded_result_type
operator()( const Point_2& p, const Point_2& q) const
{ return LK_Compute_squared_radius_2()(p, q); }
result_type
forwarded_result_type
operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
{ return LK_Compute_squared_radius_2()(p, q, r); }
#endif
const result_type&
const forwarded_result_type&
operator()(const Circular_arc_2& c) const
{ return c.rep().squared_radius(); }
};
} // namespace CircularFunctors
#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCH
template < typename K>
struct Qualified_result_of<CircularFunctors::Construct_center_2<K>,
typename K::Circular_arc_2>
{
typedef typename K::Point_2 const & type;
};
template < typename K>
struct Qualified_result_of<CircularFunctors::Compute_squared_radius_2<K>,
typename K::Circular_arc_2>
{
typedef typename K::FT const & type;
};
template < typename K>
struct Qualified_result_of<CircularFunctors::Compute_squared_radius_2<K>,
typename K::Circle_2>
{
typedef typename K::FT const & type;
};
#endif
} // namespace CGAL
#endif // CGAL_CIRCULAR_KERNEL_FUNCTION_OBJECTS_POLYNOMIAL_CIRCULAR_H

View File

@ -25,6 +25,8 @@
#ifndef CGAL_LINE_ARC_2_H
#define CGAL_LINE_ARC_2_H
#include <boost/result_of.hpp>
namespace CGAL {
template <class CircularKernel>
@ -92,33 +94,25 @@ public:
: RLine_arc_2(a)
{}
typename Qualified_result_of
<typename R::Construct_circular_source_vertex_2,Line_arc_2>::type
//const Circular_arc_point_2 &
typename boost::result_of<R::Construct_circular_source_vertex_2(Line_arc_2)>::type
source() const
{
return typename R::Construct_circular_source_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_target_vertex_2,Line_arc_2>::type
//const Circular_arc_point_2 &
typename boost;:result_of<R::Construct_circular_target_vertex_2(Line_arc_2)>::type
target() const
{
return typename R::Construct_circular_target_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_min_vertex_2,Line_arc_2>::type
//const Circular_arc_point_2 & left() const
typename boost;:result_of<R::Construct_circular_min_vertex_2(Line_arc_2)>::type
left() const
{
return typename R::Construct_circular_min_vertex_2()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_max_vertex_2,Line_arc_2>::type
//const Circular_arc_point_2 & right() const
typename boost;:result_of<R::Construct_circular_max_vertex_2(Line_arc_2)>::type
right() const
{
return typename R::Construct_circular_max_vertex_2()(*this);

View File

@ -119,22 +119,19 @@ namespace CGAL {
: RCircular_arc_3(a)
{}
typename Qualified_result_of
<typename R::Construct_circular_source_vertex_3,Circular_arc_3>::type
typename boost::result_of<typename R::Construct_circular_source_vertex_3(Circular_arc_3)>::type
source() const
{
return typename R::Construct_circular_source_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_target_vertex_3,Circular_arc_3>::type
typename boost::result_of<typename R::Construct_circular_target_vertex_3(Circular_arc_3)>::type
target() const
{
return typename R::Construct_circular_target_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_circle_3,Circular_arc_3>::type
typename boost::result_of<typename R::Construct_circle_3(Circular_arc_3)>::type
supporting_circle() const
{
return typename R::Construct_circle_3()(*this);

View File

@ -196,18 +196,15 @@ public:
typename Qualified_result_of<typename R::Compute_circular_x_3,Circular_arc_point_3>::type
//const Root_of_2 &
typename boost::result_of<typename R::Compute_circular_x_3(Circular_arc_point_3)>::type
x() const
{ return typename R::Compute_circular_x_3()(*this);}
typename Qualified_result_of<typename R::Compute_circular_y_3,Circular_arc_point_3>::type
//const Root_of_2 &
typename boost::result_of<typename R::Compute_circular_y_3(Circular_arc_point_3)>::type
y() const
{ return typename R::Compute_circular_y_3()(*this);}
typename Qualified_result_of<typename R::Compute_circular_z_3,Circular_arc_point_3>::type
//const Root_of_2 &
typename boost::result_of<typename R::Compute_circular_z_3(Circular_arc_point_3)>::type
z() const
{ return typename R::Compute_circular_z_3()(*this);}

View File

@ -106,47 +106,44 @@ template < class SK > \
CGAL_SPHERICAL_KERNEL_MACRO_FUNCTOR_COMPARE_(xyz)
template <class SK>
class Compute_circular_x_3: Has_qrt
class Compute_circular_x_3
{
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Root_of_2 Root_of_2;
public:
typedef Root_of_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Root_of_2& result_type;
qualified_result_type operator() (const Circular_arc_point_3 & a) const
result_type operator() (const Circular_arc_point_3 & a) const
{ return (a.rep().x()); }
};
template <class SK>
class Compute_circular_y_3: Has_qrt
class Compute_circular_y_3
{
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Root_of_2 Root_of_2;
public:
typedef Root_of_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Root_of_2& result_type;
qualified_result_type operator() (const Circular_arc_point_3 & a) const
result_type operator() (const Circular_arc_point_3 & a) const
{ return (a.rep().y()); }
};
template <class SK>
class Compute_circular_z_3: Has_qrt
class Compute_circular_z_3
{
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
typedef typename SK::Root_of_2 Root_of_2;
public:
typedef Root_of_2 result_type;
typedef const result_type & qualified_result_type;
typedef const Root_of_2& result_type;
qualified_result_type operator() (const Circular_arc_point_3 & a) const
result_type operator() (const Circular_arc_point_3 & a) const
{ return (a.rep().z()); }
};
@ -616,89 +613,83 @@ template < class SK > \
template <class SK>
class Construct_line_3
#ifndef CGAL_CFG_MATCHING_BUG_6
: public SK::Linear_kernel::Construct_line_3
#endif
{
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Line_3 Line_3;
typedef typename SK::Linear_kernel::Construct_line_3::result_type forwarded_result_type;
public:
typedef typename SK::Linear_kernel::Construct_line_3::result_type
result_type;
typedef const result_type & qualified_result_type;
#ifndef CGAL_CFG_MATCHING_BUG_6
using SK::Linear_kernel::Construct_line_3::operator();
#else
typedef typename SK::Point_3 Point_3;
typedef typename SK::Direction_3 Direction_3;
typedef typename SK::Vector_3 Vector_3;
typedef typename SK::Segment_3 Segment_3;
typedef typename SK::Ray_3 Ray_3;
typedef typename SK::Linear_kernel::Construct_line_3 LK_Construct_line_3;
result_type
template<class>
struct result {
typedef forwarded_result_type type;
};
template<typename F>
struct result<F(Line_arc_3)> {
typdef const forwarded_result_type& type;
};
forwarded_result_type
operator()(Return_base_tag, const Point_3& p, const Point_3& q) const
{ return LK_Construct_line_3()(p, Vector_3(p, q)); }
result_type
forwarded_result_type
operator()(Return_base_tag, const Point_3& p, const Direction_3& d) const
{ return operator()(Return_base_tag(), p, Vector_3(d.dx(), d.dy(), d.dz())); }
result_type
forwarded_result_type
operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const
{ return LK_Construct_line_3()(p, v); }
result_type
forwarded_result_type
operator()(Return_base_tag, const Segment_3& s) const
{ return LK_Construct_line_3()(s.source(), Vector_3(s.source(), s.target())); }
result_type
forwarded_result_type
operator()(Return_base_tag, const Ray_3& r) const
{ return LK_Construct_line_3()(r.source(), Vector_3(r.source(), r.second_point())); }
result_type
forwarded_result_type
operator()(const Point_3& p, const Point_3& q) const
{ return this->operator()(Return_base_tag(), p, q); }
result_type
forwarded_result_type
operator()(const Point_3& p, const Direction_3& d) const
{ return this->operator()(Return_base_tag(), p, d); }
result_type
forwarded_result_type
operator()(const Point_3& p, const Vector_3& v) const
{ return this->operator()(Return_base_tag(), p, v); }
result_type
forwarded_result_type
operator()(const Segment_3& s) const
{ return this->operator()(Return_base_tag(), s); }
result_type
forwarded_result_type
operator()(const Ray_3& r) const
{ return this->operator()(Return_base_tag(), r); }
#endif
qualified_result_type operator() (const Line_arc_3 & a) const
const forwarded_result_type& operator() (const Line_arc_3 & a) const
{ return (a.rep().supporting_line()); }
result_type
forwarded_result_type
operator() ( const typename SK::Polynomials_for_line_3 &eq )
{ return SphericalFunctors::construct_line_3<SK>(eq); }
};
template < class SK >
class Construct_circle_3 : public SK::Linear_kernel::Construct_circle_3
class Construct_circle_3
{
public:
typedef typename SK::Linear_kernel::Construct_circle_3 Extended;
typedef typename Extended::result_type forwarded_result_type;
typedef typename SK::FT FT;
typedef typename SK::Point_3 Point_3;
typedef typename SK::Plane_3 Plane_3;
@ -709,17 +700,61 @@ template < class SK > \
typedef typename SK::Circular_arc_3 Circular_arc_3;
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;
};
typedef typename SK::Linear_kernel::Construct_circle_3::result_type result_type;
typedef const result_type & qualified_result_type;
template<typename F>
struct result<F(Circular_arc_3)> {
typedef const forwarded_result_type& type;
};
using SK::Linear_kernel::Construct_circle_3::operator();
forwarded_result_type
operator()(const Point_3& p, const FT& sr,
const Plane_3& plane) const
{ return Extended()(p, sr, plane); }
result_type
forwarded_result_type
operator() (const Point_3& p, const FT& sr,
const Vector_3& v) const
{ return Extended()(p, sr, v); }
forwarded_result_type
operator() (const Point_3& p, const FT& sr,
const Direction_3& d) const
{ return Extended()(p, sr, d); }
forwarded_result_type
operator() (const Sphere_3& s1, const Sphere_3& s2) const
{ return Extended()(s1, s2); }
forwarded_result_type
operator() (const Plane_3& p, const Sphere_3& s) const
{ return Extended()(p, s); }
forwarded_result_type
operator() (const Sphere_3& s, const Plane_3& p) const
{ return Extended()(p, s); }
forwarded_result_type
operator() (const Plane_3& p, const Sphere_3& s, int a) const
{ return Extended()(p, s, a); }
forwarded_result_type
operator() (const Sphere_3& s, const Plane_3& p, int a) const
{ return Extended()(p, s, a); }
forwarded_result_type
operator()( const Point_3& p1, const Point_3& p2, const Point_3& p3) const
{ return Extended()(p1, p2, p3); }
forwarded_result_type
operator() ( const typename SK::Polynomials_for_circle_3 &eq )
{ return Rep(construct_circle_3<SK>(eq)); }
qualified_result_type
const forwarded_result_type&
operator() (const Circular_arc_3 & a) const
{ return (a.rep().supporting_circle()); }
@ -881,39 +916,37 @@ template < class SK > \
};
template <class SK>
class Construct_circular_min_vertex_3 : Has_qrt
class Construct_circular_min_vertex_3
{
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
public:
typedef Circular_arc_point_3 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_3& result_type;
qualified_result_type operator() (const Line_arc_3 & a) const
result_type operator() (const Line_arc_3 & a) const
{ return (a.rep().lower_xyz_extremity()); }
};
template <class SK>
class Construct_circular_max_vertex_3 : Has_qrt
class Construct_circular_max_vertex_3
{
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
public:
typedef Circular_arc_point_3 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_3& result_type;
qualified_result_type operator() (const Line_arc_3 & a) const
result_type operator() (const Line_arc_3 & a) const
{ return (a.rep().higher_xyz_extremity()); }
};
template <class SK>
class Construct_circular_source_vertex_3 : Has_qrt
class Construct_circular_source_vertex_3
{
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_3 Circular_arc_3;
@ -921,19 +954,18 @@ template < class SK > \
public:
typedef Circular_arc_point_3 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_3& result_type;
qualified_result_type operator() (const Line_arc_3 & a) const
result_type operator() (const Line_arc_3 & a) const
{ return (a.rep().source()); }
qualified_result_type operator() (const Circular_arc_3 & a) const
result_type operator() (const Circular_arc_3 & a) const
{ return (a.rep().source()); }
};
template <class SK>
class Construct_circular_target_vertex_3 : Has_qrt
class Construct_circular_target_vertex_3
{
typedef typename SK::Line_arc_3 Line_arc_3;
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
@ -941,13 +973,12 @@ template < class SK > \
public:
typedef Circular_arc_point_3 result_type;
typedef const result_type & qualified_result_type;
typedef const Circular_arc_point_3& result_type;
qualified_result_type operator() (const Line_arc_3 & a) const
result_type operator() (const Line_arc_3 & a) const
{ return (a.rep().target()); }
qualified_result_type operator() (const Circular_arc_3 & a) const
result_type operator() (const Circular_arc_3 & a) const
{ return (a.rep().target()); }
};
@ -1844,20 +1875,6 @@ template < class SK > \
} // namespace SphericalFunctors
template < typename K >
struct Qualified_result_of<SphericalFunctors::Construct_line_3<K>,
typename K::Line_arc_3>
{
typedef typename K::Line_3 const & type;
};
template < typename K >
struct Qualified_result_of<SphericalFunctors::Construct_circle_3<K>,
typename K::Circular_arc_3>
{
typedef typename K::Circle_3 const & type;
};
} // namespace CGAL
#endif // CGAL_SPHERICAL_KERNEL_FUNCTION_OBJECTS_POLYNOMIAL_SPHERE_H

View File

@ -122,36 +122,31 @@ namespace CGAL {
: RLine_arc_3(a)
{}
typename Qualified_result_of
<typename R::Construct_circular_source_vertex_3,Line_arc_3>::type
typename boost::result_of<typename R::Construct_circular_source_vertex_3(Line_arc_3)>::type
source() const
{
return typename R::Construct_circular_source_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_target_vertex_3,Line_arc_3>::type
typename boost::result_of<typename R::Construct_circular_target_vertex_3(Line_arc_3)>::type
target() const
{
return typename R::Construct_circular_target_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_min_vertex_3,Line_arc_3>::type
typename boost::result_of<typename R::Construct_circular_min_vertex_3(Line_arc_3)>::type
lower_xyz_extremity() const
{
return typename R::Construct_circular_min_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_circular_max_vertex_3,Line_arc_3>::type
typename boost::result_of<typename R::Construct_circular_max_vertex_3(Line_arc_3)>::type
higher_xyz_extremity() const
{
return typename R::Construct_circular_max_vertex_3()(*this);
}
typename Qualified_result_of
<typename R::Construct_line_3,Line_arc_3>::type
typename boost::result_of<typename R::Construct_line_3(Line_arc_3)>::type
supporting_line() const
{
return typename R::Construct_line_3()(*this);

View File

@ -38,6 +38,16 @@
# include <boost/thread/tss.hpp>
#endif
#include <boost/optional.hpp>
#include <boost/preprocessor/facilities/expand.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
namespace CGAL {
template <typename AT, typename ET, typename EFT, typename E2A> class Lazy;
@ -270,7 +280,6 @@ public:
//____________________________________________________________
// The rep for the leaf node
// FIXME TODO : Factorize all the Lazy_rep_[0-8] !!!
template <typename AT, typename ET, typename E2A>
class Lazy_rep_0 : public Lazy_rep<AT, ET, E2A>
@ -304,532 +313,45 @@ public:
}
};
// Macro helpers to build the kernel objects
#define TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n;
#define TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n;
#define LEXACT(z,n,t) CGAL::exact( l##n )
#define LARGS(z, n, t) L##n const& l##n
//____________________________________________________________
#define TMAP(z, n, d) typename Type_mapper< L##n, d##K, LK >::type
#define PRUNE_TREE(z, n, d) l##n = L##n ();
#define LINIT(z, n, d) l##n(l##n)
#define LN(z, n, d) d(l##n)
#define MLIST(z, n, d) mutable L##n l##n;
template <typename AC, typename EC, typename E2A, typename L1>
class Lazy_rep_1
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
}
Lazy_rep_1(const AC& ac, const EC& ec, const L1& l1)
: Lazy_rep<AT,ET, E2A>(ac(CGAL::approx(l1))), EC(ec), l1_(l1)
{
this->set_depth(CGAL::depth(l1_) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with one child node:");
CGAL::print_dag(l1_, os, level+1);
}
}
#endif
#define LAZY_REP(z, n, d) \
template< typename AT, typename ET, typename AC, typename EC, typename E2A, BOOST_PP_ENUM_PARAMS(n, typename L)> \
class Lazy_rep_##n :public Lazy_rep< AT, \
ET, \
E2A >, \
private EC \
{ \
BOOST_PP_REPEAT(n, MLIST, _) \
const EC& ec() const { return *this; } \
public: \
void update_exact() const { \
this->et = new ET(ec()( BOOST_PP_ENUM(n, LEXACT, _) ) ); \
BOOST_PP_REPEAT(n, PRUNE_TREE, _) \
} \
Lazy_rep_##n(const AC& ac, const EC& ec, BOOST_PP_ENUM(n, LARGS, _)) \
: Lazy_rep<AT, ET, E2A>(ac( BOOST_PP_ENUM(n, LN, CGAL::approx) )), EC(ec), BOOST_PP_ENUM(n, LINIT, _) \
{ this->set_depth(max_n( BOOST_PP_ENUM(n, LN, CGAL::depth) ) + 1); } \
};
BOOST_PP_REPEAT_FROM_TO(1, 9, LAZY_REP, _)
//____________________________________________________________
template <typename AC, typename EC, typename E2A, typename L1, typename L2>
class Lazy_rep_2
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
}
Lazy_rep_2(const AC& ac, const EC& /*ec*/, const L1& l1, const L2& l2)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2))),
l1_(l1), l2_(l2)
{
this->set_depth(max_n(CGAL::depth(l1_), CGAL::depth(l2_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with two child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
}
}
#endif
};
//____________________________________________________________
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3>
class Lazy_rep_3
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
}
Lazy_rep_3(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3))),
l1_(l1), l2_(l2), l3_(l3)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with three child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
}
}
#endif
};
//____________________________________________________________
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3, typename L4>
class Lazy_rep_4
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
mutable L4 l4_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_), CGAL::exact(l4_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
l4_ = L4();
}
Lazy_rep_4(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3, const L4& l4)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3), CGAL::approx(l4))),
l1_(l1), l2_(l2), l3_(l3), l4_(l4)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_),
CGAL::depth(l4_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with four child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
CGAL::print_dag(l4_, os, level+1);
}
}
#endif
};
//____________________________________________________________
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3, typename L4, typename L5>
class Lazy_rep_5
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
mutable L4 l4_;
mutable L5 l5_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_), CGAL::exact(l4_),
CGAL::exact(l5_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
l4_ = L4();
l5_ = L5();
}
Lazy_rep_5(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3, const L4& l4,
const L5& l5)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3), CGAL::approx(l4),
CGAL::approx(l5))),
l1_(l1), l2_(l2), l3_(l3), l4_(l4), l5_(l5)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_),
CGAL::depth(l4_),
CGAL::depth(l5_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with five child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
CGAL::print_dag(l4_, os, level+1);
CGAL::print_dag(l5_, os, level+1);
}
}
#endif
};
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3, typename L4,
typename L5, typename L6>
class Lazy_rep_6
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
mutable L4 l4_;
mutable L5 l5_;
mutable L6 l6_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_), CGAL::exact(l4_),
CGAL::exact(l5_), CGAL::exact(l6_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
l4_ = L4();
l5_ = L5();
l6_ = L6();
}
Lazy_rep_6(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3, const L4& l4,
const L5& l5, const L6& l6)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3), CGAL::approx(l4),
CGAL::approx(l5), CGAL::approx(l6))),
l1_(l1), l2_(l2), l3_(l3), l4_(l4), l5_(l5), l6_(l6)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_),
CGAL::depth(l4_),
CGAL::depth(l5_),
CGAL::depth(l6_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with 6 child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
CGAL::print_dag(l4_, os, level+1);
CGAL::print_dag(l5_, os, level+1);
CGAL::print_dag(l6_, os, level+1);
}
}
#endif
};
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3, typename L4,
typename L5, typename L6, typename L7>
class Lazy_rep_7
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
mutable L4 l4_;
mutable L5 l5_;
mutable L6 l6_;
mutable L7 l7_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_), CGAL::exact(l4_),
CGAL::exact(l5_), CGAL::exact(l6_),
CGAL::exact(l7_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
l4_ = L4();
l5_ = L5();
l6_ = L6();
l7_ = L7();
}
Lazy_rep_7(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3, const L4& l4,
const L5& l5, const L6& l6, const L7& l7)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3), CGAL::approx(l4),
CGAL::approx(l5), CGAL::approx(l6),
CGAL::approx(l7))),
l1_(l1), l2_(l2), l3_(l3), l4_(l4), l5_(l5), l6_(l6), l7_(l7)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_),
CGAL::depth(l4_),
CGAL::depth(l5_),
CGAL::depth(l6_),
CGAL::depth(l7_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with 7 child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
CGAL::print_dag(l4_, os, level+1);
CGAL::print_dag(l5_, os, level+1);
CGAL::print_dag(l6_, os, level+1);
CGAL::print_dag(l7_, os, level+1);
}
}
#endif
};
template <typename AC, typename EC, typename E2A,
typename L1, typename L2, typename L3, typename L4,
typename L5, typename L6, typename L7, typename L8>
class Lazy_rep_8
: public Lazy_rep<typename AC::result_type, typename EC::result_type, E2A>
, private EC
{
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_rep<AT, ET, E2A> Base;
mutable L1 l1_;
mutable L2 l2_;
mutable L3 l3_;
mutable L4 l4_;
mutable L5 l5_;
mutable L6 l6_;
mutable L7 l7_;
mutable L8 l8_;
const EC& ec() const { return *this; }
public:
void
update_exact() const
{
this->et = new ET(ec()(CGAL::exact(l1_), CGAL::exact(l2_),
CGAL::exact(l3_), CGAL::exact(l4_),
CGAL::exact(l5_), CGAL::exact(l6_),
CGAL::exact(l7_), CGAL::exact(l8_)));
this->at = E2A()(*(this->et));
// Prune lazy tree
l1_ = L1();
l2_ = L2();
l3_ = L3();
l4_ = L4();
l5_ = L5();
l6_ = L6();
l7_ = L7();
l8_ = L8();
}
Lazy_rep_8(const AC& ac, const EC& /*ec*/,
const L1& l1, const L2& l2, const L3& l3, const L4& l4,
const L5& l5, const L6& l6, const L7& l7, const L8& l8)
: Lazy_rep<AT,ET,E2A>(ac(CGAL::approx(l1), CGAL::approx(l2),
CGAL::approx(l3), CGAL::approx(l4),
CGAL::approx(l5), CGAL::approx(l6),
CGAL::approx(l7), CGAL::approx(l8))),
l1_(l1), l2_(l2), l3_(l3), l4_(l4), l5_(l5), l6_(l6), l7_(l7), l8_(l8)
{
this->set_depth(max_n(CGAL::depth(l1_),
CGAL::depth(l2_),
CGAL::depth(l3_),
CGAL::depth(l4_),
CGAL::depth(l5_),
CGAL::depth(l6_),
CGAL::depth(l7_),
CGAL::depth(l8_)) + 1);
}
#ifdef CGAL_LAZY_KERNEL_DEBUG
void
print_dag(std::ostream& os, int level) const
{
this->print_at_et(os, level);
if(this->is_lazy()){
CGAL::msg(os, level, "DAG with 8 child nodes:");
CGAL::print_dag(l1_, os, level+1);
CGAL::print_dag(l2_, os, level+1);
CGAL::print_dag(l3_, os, level+1);
CGAL::print_dag(l4_, os, level+1);
CGAL::print_dag(l5_, os, level+1);
CGAL::print_dag(l6_, os, level+1);
CGAL::print_dag(l7_, os, level+1);
CGAL::print_dag(l8_, os, level+1);
}
}
#endif
};
#undef TMAP
#undef PRUNE_TREE
#undef LINIT
#undef LAZY_REP
#undef LN
#undef MLIST
template < typename K1, typename K2 >
struct Approx_converter
@ -1184,10 +706,6 @@ private:
Self_rep * ptr() const { return (Self_rep*) PTR; }
};
// The magic functor for Construct_bbox_[2,3], as there is no Lazy<Bbox>
template <typename LK, typename AC, typename EC>
@ -1217,6 +735,7 @@ struct Lazy_construction_bbox
}
};
template <typename LK, typename AC, typename EC>
struct Lazy_construction_nt {
@ -1225,82 +744,49 @@ struct Lazy_construction_nt {
typedef typename LK::Approximate_kernel AK;
typedef typename LK::Exact_kernel EK;
typedef typename LK::E2A E2A;
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy_exact_nt<ET> result_type;
AC ac;
EC ec;
template <typename L1>
result_type operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return new Lazy_rep_1<AC, EC, To_interval<ET>, L1>(ac, ec, l1);
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1)));
}
}
template<typename>
struct result { };
template <typename L1, typename L2>
result_type operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return new Lazy_rep_2<AC, EC, To_interval<ET>, L1,L2>(ac, ec, l1,l2);
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2)));
}
}
#define 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, TYPEMAP_EC, T) \
typedef Lazy_exact_nt< \
typename boost::remove_cv< typename boost::remove_reference < \
typename boost::result_of<EC( BOOST_PP_ENUM_PARAMS(n, E) )>::type >::type >::type > type; \
};
template <typename L1, typename L2, typename L3>
result_type 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);
Protect_FPU_rounding<Protection> P;
try {
return new Lazy_rep_3<AC, EC, To_interval<ET>, L1,L2,L3>(ac, ec, l1,l2,l3);
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)));
}
}
BOOST_PP_REPEAT_FROM_TO(1, 9, RESULT_NT, _)
template <typename L1, typename L2, typename L3, typename L4>
result_type operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return new Lazy_rep_4<AC, EC, To_interval<ET>, L1,L2,L3,L4>(ac, ec, l1,l2,l3,l4);
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4)));
}
}
#define NT_OPERATOR(z, n, d) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
typename boost::result_of<Lazy_construction_nt(BOOST_PP_ENUM_PARAMS(n, L))>::type \
operator()( BOOST_PP_ENUM(n, LARGS, _) ) { \
BOOST_PP_REPEAT(n, TYPEMAP_EC, L) \
BOOST_PP_REPEAT(n, TYPEMAP_AC, L) \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename boost::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename boost::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
Protect_FPU_rounding<Protection> P; \
try { \
return new Lazy_rep_##n<AT, ET, AC, EC, To_interval<ET>, BOOST_PP_ENUM_PARAMS(n, L) >(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)); \
} catch (Uncertain_conversion_exception) { \
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( BOOST_PP_ENUM(n, LEXACT, _) )); \
} \
} \
template <typename L1, typename L2, typename L3, typename L4, typename L5>
result_type operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return new Lazy_rep_5<AC, EC, To_interval<ET>, L1,L2,L3,L4,L5>(ac, ec, l1,l2,l3,l4,l5);
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5)));
}
}
BOOST_PP_REPEAT_FROM_TO(1, 6, NT_OPERATOR, _)
#undef INTERVAL_OPERATOR
#undef RESULT_NT
};
@ -1558,8 +1044,8 @@ public:
typedef Lazy<std::pair<typename R1::AT, typename R2::AT>, std::pair<typename R1::ET, typename R2::ET>, EFT, E2A> Lazy_pair;
Lazy_pair lv(new Lazy_rep_2_2<AC, EC, E2A, L1, L2, R1, R2>(ac, ec, l1, l2));
// lv->approx() is a std::pair<R1::AT, R2::AT>;
r1 = R1(Handle_1(new Lazy_rep_1<First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
r2 = R2(Handle_2(new Lazy_rep_1<Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
r1 = R1(Handle_1(new Lazy_rep_1<void, void, First<std::pair<typename R1::AT, typename R2::AT> >, First<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(First<std::pair<typename R1::AT, typename R2::AT> >(), First<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
r2 = R2(Handle_2(new Lazy_rep_1<void, void, Second<std::pair<typename R1::AT, typename R2::AT> >, Second<std::pair<typename R1::ET, typename R2::ET> >, E2A, Lazy_pair>(Second<std::pair<typename R1::AT, typename R2::AT> >(), Second<std::pair<typename R1::ET, typename R2::ET> >(), lv)));
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
@ -1606,7 +1092,7 @@ public:
for (unsigned int i = 0; i < lv.approx().size(); i++) {
// FIXME : I'm not sure how this work...
#define CGAL_Kernel_obj(X) if (object_cast<typename AK::X>(& (lv.approx()[i]))) { \
*it++ = make_object(typename LK::X(new Lazy_rep_1<Ith<typename AK::X>, \
*it++ = make_object(typename LK::X(new Lazy_rep_1<typename AK::X, typename EK::X, Ith<typename AK::X>, \
Ith<typename EK::X>, E2A, Lazy_vector> \
(Ith<typename AK::X>(i), Ith<typename EK::X>(i), lv))); \
continue; \
@ -1679,14 +1165,14 @@ public:
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
Lazy_object lo(new Lazy_rep_1<AC, EC, E2A, L1>(ac, ec, l1));
Lazy_object lo(new Lazy_rep_1<result_type, result_type, AC, EC, E2A, L1>(ac, ec, l1));
if(lo.approx().is_empty())
return Object();
#define CGAL_Kernel_obj(X) \
if (object_cast<typename AK::X>(& (lo.approx()))) { \
typedef Lazy_rep_1<Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
typedef Lazy_rep_1< typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
return make_object(typename LK::X(lcr)); \
}
@ -1712,14 +1198,14 @@ public:
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
Lazy_object lo(new Lazy_rep_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
Lazy_object lo(new Lazy_rep_2<result_type, result_type, AC, EC, E2A, L1, L2>(ac, ec, l1, l2));
if(lo.approx().is_empty())
return Object();
#define CGAL_Kernel_obj(X) \
if (object_cast<typename AK::X>(& (lo.approx()))) { \
typedef Lazy_rep_1<Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
typedef Lazy_rep_1<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
return make_object(typename LK::X(lcr)); \
}
@ -1735,7 +1221,7 @@ public:
std::vector<typename LK::X> V;\
V.resize(v_ptr->size()); \
for (unsigned int i = 0; i < v_ptr->size(); i++) { \
V[i] = typename LK::X(new Lazy_rep_1<Ith_for_intersection<typename AK::X>, \
V[i] = typename LK::X(new Lazy_rep_1<typename AK::X, typename EK::X, Ith_for_intersection<typename AK::X>, \
Ith_for_intersection<typename EK::X>, E2A, Lazy_object> \
(Ith_for_intersection<typename AK::X>(i), Ith_for_intersection<typename EK::X>(i), lo)); \
} \
@ -1766,14 +1252,14 @@ CGAL_Kernel_obj(Point_3)
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
Lazy_object lo(new Lazy_rep_3<AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
Lazy_object lo(new Lazy_rep_3<result_type, result_type, AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3));
if(lo.approx().is_empty())
return Object();
#define CGAL_Kernel_obj(X) \
if (object_cast<typename AK::X>(& (lo.approx()))) { \
typedef Lazy_rep_1<Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
typedef Lazy_rep_1<typename AK::X, typename EK::X, Object_cast<typename AK::X>, Object_cast<typename EK::X>, E2A, Lazy_object> Lcr; \
Lcr * lcr = new Lcr(Object_cast<typename AK::X>(), Object_cast<typename EK::X>(), lo); \
return make_object(typename LK::X(lcr)); \
}
@ -1808,144 +1294,71 @@ struct Lazy_construction
typedef typename LK::Exact_kernel EK;
typedef typename EK::FT EFT;
typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A;
typedef typename AC::result_type AT;
typedef typename EC::result_type ET;
typedef Lazy<AT, ET, EFT, E2A> Handle;
typedef typename Type_mapper<AT,AK,LK>::type result_type;
template<typename>
struct result {
// this does not default, if you want to make a lazy lazy-kernel,
// you are on your own
};
AC ac;
EC ec;
public:
// acquire the result_type of the approximate kernel, map it back to the lazy kernel object
#define RESULT(z, n, d) \
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, TYPEMAP_AC, T) \
typedef typename Type_mapper< typename boost::result_of<AC( BOOST_PP_ENUM_PARAMS(n, A) )>::type, AK, LK>::type type; \
};
result_type
BOOST_PP_REPEAT_FROM_TO(1, 9, RESULT, _)
#define CONSTRUCTION_OPERATOR(z, n, d) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
typename boost::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type \
operator()( BOOST_PP_ENUM(n, LARGS, _) ) { \
BOOST_PP_REPEAT(n, TYPEMAP_EC, L) \
BOOST_PP_REPEAT(n, TYPEMAP_AC, L) \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename boost::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename boost::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
typedef Lazy< AT, ET, EFT, E2A> Handle; \
typedef typename boost::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
Protect_FPU_rounding<Protection> P; \
try { \
return result_type( Handle(new Lazy_rep_##n<AT, ET, AC, EC, E2A, BOOST_PP_ENUM_PARAMS(n, L)>(ac, ec, BOOST_PP_ENUM_PARAMS(n, l)))); \
} catch (Uncertain_conversion_exception) { \
CGAL_BRANCH_PROFILER_BRANCH(tmp); \
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST); \
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec( BOOST_PP_ENUM(n, LEXACT, _) ))) ); \
} \
}
// arity 1-8
BOOST_PP_REPEAT_FROM_TO(1, 9, CONSTRUCTION_OPERATOR, _)
// nullary
typename Type_mapper< typename boost::result_of<AC()>::type ,AK, LK>::type
operator()() const
{
typedef typename boost::result_of<AC()>::type AT;
typedef typename boost::result_of<EC()>::type ET;
typedef Lazy<AT, ET, EFT, E2A> Handle;
typedef typename Type_mapper< typename boost::result_of<AC()>::type ,AK, LK>::type result_type;
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
}
template <typename L1>
result_type
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_1<AC, EC, E2A, L1>(ac, ec, l1)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1)))) );
}
}
template <typename L1, typename L2>
result_type
operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_2<AC, EC, E2A, L1, L2>(ac, ec, l1, l2)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2)))) );
}
}
template <typename L1, typename L2, typename L3>
result_type
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);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_3<AC, EC, E2A, L1, L2, L3>(ac, ec, l1, l2, l3)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3)))) );
}
}
template <typename L1, typename L2, typename L3, typename L4>
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_4<AC, EC, E2A, L1, L2, L3, L4>(ac, ec, l1, l2, l3, l4)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4)))) );
}
}
template <typename L1, typename L2, typename L3, typename L4, typename L5>
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_5<AC, EC, E2A, L1, L2, L3, L4, L5>(ac, ec, l1, l2, l3, l4, l5)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5)))) );
}
}
template <typename L1, typename L2, typename L3, typename L4, typename L5, typename L6>
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_6<AC, EC, E2A, L1, L2, L3, L4, L5, L6>(ac, ec, l1, l2, l3, l4, l5, l6)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6)))) );
}
}
template <typename L1, typename L2, typename L3, typename L4, typename L5, typename L6, typename L7>
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6, const L7& l7) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_7<AC, EC, E2A, L1, L2, L3, L4, L5, L6, L7>(ac, ec, l1, l2, l3, l4, l5, l6, l7)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6), CGAL::exact(l7)))) );
}
}
template <typename L1, typename L2, typename L3, typename L4, typename L5, typename L6, typename L7, typename L8>
result_type
operator()(const L1& l1, const L2& l2, const L3& l3, const L4& l4, const L5& l5, const L6& l6, const L7& l7, const L8& l8) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
return result_type( Handle(new Lazy_rep_8<AC, EC, E2A, L1, L2, L3, L4, L5, L6, L7, L8>(ac, ec, l1, l2, l3, l4, l5, l6, l7, l8)) );
} catch (Uncertain_conversion_exception) {
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> P2(CGAL_FE_TONEAREST);
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>(ec(CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3), CGAL::exact(l4), CGAL::exact(l5), CGAL::exact(l6), CGAL::exact(l7), CGAL::exact(l8)))) );
}
}
};
} //namespace CGAL
#undef TYPEMAP_AC
#undef TYPEMAP_EC
#undef LEXACT
#undef LARGS
#endif // CGAL_LAZY_H

View File

@ -32,9 +32,39 @@
#include <CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h>
#include <CGAL/Lazy.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/not.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/remove_cv.hpp>
namespace CGAL {
namespace internal {
template<typename T>
// helper to make result access lazy
struct Delayed_void_result {
typedef typename T::template result<void>::type type;
};
template<typename T>
struct foobar;
// goes through the standard process of selecting the right
// Lazy_something after the kind of the return type has been
// determined
template<typename T, typename AK, typename EK, typename Kernel, typename AKC, typename EKC>
struct Standard_pick {
typedef typename boost::remove_cv< typename boost::remove_reference< T >::type >::type T_;
typedef typename boost::mpl::if_< boost::is_same< T_, typename AK::FT >,
Lazy_construction_nt<Kernel, AKC, EKC>,
typename boost::mpl::if_< boost::is_same< T_, Object >,
Lazy_construction_object<Kernel, AKC, EKC>,
Lazy_construction<Kernel, AKC, EKC> >::type
>::type type;
};
} // internal
// Exact_kernel = exact kernel that will be made lazy
// Kernel = lazy kernel
@ -147,16 +177,22 @@ public:
intersect_with_iterators_2_object)
#else
#define CGAL_Kernel_cons(C, Cf) \
typedef typename boost::mpl::if_< boost::is_same<typename Approximate_kernel::C::result_type, typename Approximate_kernel::FT>,\
Lazy_construction_nt<Kernel,typename Approximate_kernel::C, typename Exact_kernel::C>,\
typename boost::mpl::if_<boost::is_same<typename Approximate_kernel::C::result_type, Object >,\
Lazy_construction_object<Kernel,typename Approximate_kernel::C, typename Exact_kernel::C>,\
Lazy_construction<Kernel,typename Approximate_kernel::C, typename Exact_kernel::C> >::type >::type C; \
typedef typename boost::mpl::eval_if< boost::mpl::not_< boost::is_same< typename boost::result_of< typename Approximate_kernel::C () >::type, void > >, \
internal::Standard_pick< typename boost::result_of<typename Approximate_kernel::C () >::type, Approximate_kernel, Exact_kernel, Kernel, typename Approximate_kernel::C, typename Exact_kernel::C >, \
internal::Standard_pick< typename boost::mpl::eval_if< boost::is_same< typename boost::result_of< typename Approximate_kernel::C () >::type, void >, \
internal::Delayed_void_result< typename Approximate_kernel::C >, \
boost::mpl::identity<void> >::type, \
Approximate_kernel, Exact_kernel, Kernel, typename Approximate_kernel::C, typename Exact_kernel::C > \
>::type C; \
C Cf() const { return C(); }
#endif //CGAL_INTERSECT_WITH_ITERATORS_2
#include <CGAL/Kernel/interface_macros.h>
};

View File

@ -1560,15 +1560,15 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_dx_2 : public Has_qrt
class Compute_dx_2
{
typedef typename K::RT RT;
typedef typename K::Direction_2 Direction_2;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Direction_2& d) const
{
return d.rep().dx();
@ -1576,15 +1576,15 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_dx_3 : public Has_qrt
class Compute_dx_3
{
typedef typename K::RT RT;
typedef typename K::Direction_3 Direction_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dx();
@ -1592,15 +1592,15 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_dy_2 : public Has_qrt
class Compute_dy_2
{
typedef typename K::RT RT;
typedef typename K::Direction_2 Direction_2;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Direction_2& d) const
{
return d.rep().dy();
@ -1608,15 +1608,15 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_dy_3 : public Has_qrt
class Compute_dy_3
{
typedef typename K::RT RT;
typedef typename K::Direction_3 Direction_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dy();
@ -1624,15 +1624,15 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_dz_3 : public Has_qrt
class Compute_dz_3
{
typedef typename K::RT RT;
typedef typename K::Direction_3 Direction_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Direction_3& d) const
{
return d.rep().dz();
@ -1640,7 +1640,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hx_2 : public Has_qrt
class Compute_hx_2
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1648,15 +1648,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_2 Vector_2;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hx();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hx();
@ -1664,7 +1664,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hx_3 : public Has_qrt
class Compute_hx_3
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1672,15 +1672,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_3 Vector_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hx();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hx();
@ -1688,7 +1688,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hy_2 : public Has_qrt
class Compute_hy_2
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1696,15 +1696,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_2 Vector_2;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hy();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hy();
@ -1712,7 +1712,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hy_3 : public Has_qrt
class Compute_hy_3
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1720,15 +1720,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_3 Vector_3;
public:
typedef RT result_type;
typedef const RT & result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hy();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hy();
@ -1736,7 +1736,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hz_3 : public Has_qrt
class Compute_hz_3
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1744,15 +1744,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_3 Vector_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hz();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hz();
@ -1760,7 +1760,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hw_2 : public Has_qrt
class Compute_hw_2
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1768,15 +1768,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_2 Vector_2;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_2& p) const
{
return p.rep().hw();
}
const result_type &
result_type
operator()(const Vector_2& v) const
{
return v.rep().hw();
@ -1784,7 +1784,7 @@ namespace HomogeneousKernelFunctors {
};
template <typename K>
class Compute_hw_3 : public Has_qrt
class Compute_hw_3
{
typedef typename K::FT FT;
typedef typename K::RT RT;
@ -1792,15 +1792,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Vector_3 Vector_3;
public:
typedef RT result_type;
typedef const RT& result_type;
const result_type &
result_type
operator()(const Point_3& p) const
{
return p.rep().hw();
}
const result_type &
result_type
operator()(const Vector_3& v) const
{
return v.rep().hw();
@ -3517,7 +3517,15 @@ namespace HomogeneousKernelFunctors {
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
typedef typename K::Triangle_2 Triangle_2;
public:
typedef Point_2 result_type;
template<typename>
struct result {
typedef const Point_2& type;
};
template<typename F>
struct result<F(Iso_rectangle_2)> {
typedef Point_2 type;
};
const Point_2 &
operator()( const Segment_2& s, int i) const
@ -3527,7 +3535,7 @@ namespace HomogeneousKernelFunctors {
operator()( const Triangle_2& t, int i) const
{ return t.rep().vertex(i); }
const Point_2
Point_2
operator()( const Iso_rectangle_2& r, int i) const
{
switch (i%4) {
@ -3547,22 +3555,6 @@ namespace HomogeneousKernelFunctors {
} //namespace HomogeneousKernelFunctors
#ifndef CGAL_CFG_DONT_OVERLOAD_TOO_MUCH
template < typename K>
struct Qualified_result_of<HomogeneousKernelFunctors::Construct_vertex_2<K>, typename K::Segment_2, int >
{
typedef typename K::Point_2 const & type;
};
template < typename K>
struct Qualified_result_of<HomogeneousKernelFunctors::Construct_vertex_2<K>, typename K::Triangle_2, int >
{
typedef typename K::Point_2 const & type;
};
#endif
// For Iso_rectangle the non specialized template will do the right thing, namely return a copy of a point
namespace HomogeneousKernelFunctors {
template <typename K>

View File

@ -95,13 +95,13 @@ public:
Circle_2(const Point_2 & center)
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {}
typename Qualified_result_of<typename R::Construct_center_2,Circle_2>::type
typename boost::result_of<typename R::Construct_center_2(Circle_2)>::type
center() const
{
return R().construct_center_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_squared_radius_2,Circle_2>::type
typename boost::result_of<typename R::Compute_squared_radius_2(Circle_2)>::type
squared_radius() const
{
return R().compute_squared_radius_2_object()(*this);

View File

@ -101,8 +101,8 @@ public:
Circle_3(const Rep& r)
: Rep(r) {}
typename Qualified_result_of
<typename R::Construct_sphere_3, Circle_3>::type
typename boost::result_of
<typename R::Construct_sphere_3( Circle_3)>::type
diametral_sphere() const
{
return typename R::Construct_sphere_3()(*this);
@ -118,8 +118,8 @@ public:
return typename R::Construct_sphere_3()(*this).squared_radius();
}
typename Qualified_result_of
<typename R::Construct_plane_3, Circle_3>::type
typename boost::result_of
<typename R::Construct_plane_3( Circle_3)>::type
supporting_plane() const
{
return typename R::Construct_plane_3()(*this);

View File

@ -98,19 +98,19 @@ public:
return R().construct_perpendicular_direction_2_object()(*this,o);
}
typename Qualified_result_of<typename R::Compute_dx_2, Direction_2>::type
typename boost::result_of<typename R::Compute_dx_2( Direction_2)>::type
dx() const
{
return R().compute_dx_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_dy_2, Direction_2>::type
typename boost::result_of<typename R::Compute_dy_2( Direction_2)>::type
dy() const
{
return R().compute_dy_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_dx_2, Direction_2>::type
typename boost::result_of<typename R::Compute_dx_2( Direction_2)>::type
delta(int i) const
{
CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) );

View File

@ -104,25 +104,25 @@ public:
Vector_3 vector() const { return to_vector(); }
typename Qualified_result_of<typename R::Compute_dx_3, Direction_3>::type
typename boost::result_of<typename R::Compute_dx_3(Direction_3)>::type
dx() const
{
return R().compute_dx_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_dy_3, Direction_3>::type
typename boost::result_of<typename R::Compute_dy_3(Direction_3)>::type
dy() const
{
return R().compute_dy_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_dz_3, Direction_3>::type
typename boost::result_of<typename R::Compute_dz_3(Direction_3)>::type
dz() const
{
return R().compute_dz_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_dx_3, Direction_3>::type
typename boost::result_of<typename R::Compute_dx_3(Direction_3)>::type
delta(int i) const
{
CGAL_kernel_precondition( i >= 0 && i <= 2 );

View File

@ -90,75 +90,67 @@ public:
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), min_hx, min_hy, min_hz,
max_hx, max_hy, max_hz)) {}
// TODO FIXME : why is Qrt not working here ?
// TODO : the Cartesian and Homogeneous functors should be split here
// given that the Qrt differs.
// (or is the Homogeneous optimization simply not worth it ?)
//typename Qualified_result_of<typename R::Construct_min_vertex_3, Iso_cuboid_3 >::type
Point_3
typename boost::result_of<typename R::Construct_min_vertex_3( Iso_cuboid_3 )>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_min_vertex_3_object()(*this);
}
//typename Qualified_result_of<typename R::Construct_max_vertex_3, Iso_cuboid_3 >::type
Point_3
typename boost::result_of<typename R::Construct_max_vertex_3( Iso_cuboid_3 )>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_max_vertex_3_object()(*this);
}
//typename Qualified_result_of<typename R::Construct_vertex_3, Iso_cuboid_3 >::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3( Iso_cuboid_3 )>::type
vertex(int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
//typename Qualified_result_of<typename R::Construct_vertex_3, Iso_cuboid_3 >::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3( Iso_cuboid_3 )>::type
operator[](int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
typename Qualified_result_of<typename R::Compute_xmin_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type
xmin() const
{
return R().compute_xmin_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_xmax_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type
xmax() const
{
return R().compute_xmax_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_ymin_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_ymin_3( Iso_cuboid_3 )>::type
ymin() const
{
return R().compute_ymin_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_ymax_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_ymax_3( Iso_cuboid_3 )>::type
ymax() const
{
return R().compute_ymax_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_zmin_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_zmin_3( Iso_cuboid_3 )>::type
zmin() const
{
return R().compute_zmin_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_zmax_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_zmax_3( Iso_cuboid_3 )>::type
zmax() const
{
return R().compute_zmax_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_xmin_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type
min_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -170,7 +162,7 @@ public:
return zmin();
}
typename Qualified_result_of<typename R::Compute_xmax_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type
max_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -218,7 +210,7 @@ public:
return R().is_degenerate_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_volume_3, Iso_cuboid_3 >::type
typename boost::result_of<typename R::Compute_volume_3( Iso_cuboid_3 )>::type
volume() const
{
return R().compute_volume_3_object()(*this);

View File

@ -87,13 +87,13 @@ public:
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), min_hx, min_hy, max_hx, max_hy, hw)) {}
typename Qualified_result_of<typename R::Construct_min_vertex_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Construct_min_vertex_2( Iso_rectangle_2 )>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_min_vertex_2_object()(*this);
}
typename Qualified_result_of<typename R::Construct_max_vertex_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Construct_max_vertex_2( Iso_rectangle_2 )>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_max_vertex_2_object()(*this);
@ -112,43 +112,45 @@ public:
}
typename Qualified_result_of<typename R::Construct_vertex_2, Iso_rectangle_2 >::type
// typename boost::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type
Point_2
vertex(int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename Qualified_result_of<typename R::Construct_vertex_2, Iso_rectangle_2 >::type
// typename boost::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type
Point_2
operator[](int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename Qualified_result_of<typename R::Compute_xmin_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
xmin() const
{
return R().compute_xmin_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_xmax_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_xmax_2( Iso_rectangle_2 )>::type
xmax() const
{
return R().compute_xmax_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_ymin_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_ymin_2( Iso_rectangle_2 )>::type
ymin() const
{
return R().compute_ymin_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_ymax_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_ymax_2( Iso_rectangle_2 )>::type
ymax() const
{
return R().compute_ymax_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_xmin_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
min_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 );
@ -158,7 +160,7 @@ public:
return ymin();
}
typename Qualified_result_of<typename R::Compute_xmin_2, Iso_rectangle_2 >::type
typename boost::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
max_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 );

View File

@ -26,28 +26,38 @@
#define CGAL_KERNEL_TYPE_MAPPER_H
#include <CGAL/basic.h>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace CGAL {
namespace internal {
template<typename T, typename K1, typename K2 >
struct Type_mapper_impl {
typedef T type;
};
// Then we specialize for all kernel objects.
#define CGAL_Kernel_obj(X) \
template < typename K1, typename K2 > \
struct Type_mapper_impl < typename K1::X, K1, K2 > \
{ typedef typename K2::X type; };
#include <CGAL/Kernel/interface_macros.h>
} // internal
// This is a tool to obtain the K2::Point_2 from K1 and K1::Point_2.
// Similarly for other kernel types.
// TODO : add more specializations ? Use a different mechanism ?
template < typename T, typename K1, typename K2 >
struct Type_mapper
{
typedef T type; // By default, assume same type (e.g. Object).
};
// Then we specialize for all kernel objects.
#define CGAL_Kernel_obj(X) \
template < typename K1, typename K2 > \
struct Type_mapper < typename K1::X, K1, K2 > \
{ typedef typename K2::X type; };
#include <CGAL/Kernel/interface_macros.h>
struct Type_mapper :
internal::Type_mapper_impl< typename boost::remove_cv<
typename boost::remove_reference < T >::type
>::type, K1, K2 >
{ };
} //namespace CGAL

View File

@ -766,32 +766,32 @@ namespace CommonKernelFunctors {
};
template <typename K>
class Construct_center_2 : Has_qrt
class Construct_center_2
{
typedef typename K::Point_2 Point_2;
typedef typename K::Circle_2 Circle_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const Point_2 &
result_type
operator()(const Circle_2& c) const
{ return c.rep().center(); }
};
template <typename K>
class Construct_center_3 : Has_qrt
class Construct_center_3
{
typedef typename K::Point_3 Point_3;
typedef typename K::Sphere_3 Sphere_3;
typedef typename K::Circle_3 Circle_3;
public:
typedef Point_3 result_type;
typedef const Point_3& result_type;
const Point_3 &
result_type
operator()(const Sphere_3& s) const
{ return s.rep().center(); }
const Point_3 &
result_type
operator()(const Circle_3& c) const
{ return c.rep().center(); }
@ -1064,38 +1064,38 @@ namespace CommonKernelFunctors {
};
template <typename K>
class Construct_max_vertex_2 : Has_qrt
class Construct_max_vertex_2
{
typedef typename K::Point_2 Point_2;
typedef typename K::Segment_2 Segment_2;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const Point_2&
result_type
operator()(const Iso_rectangle_2& r) const
{ return (r.rep().max)(); }
const Point_2&
result_type
operator()(const Segment_2& s) const
{ return (s.max)(); }
};
template <typename K>
class Construct_min_vertex_2 : Has_qrt
class Construct_min_vertex_2
{
typedef typename K::Point_2 Point_2;
typedef typename K::Segment_2 Segment_2;
typedef typename K::Iso_rectangle_2 Iso_rectangle_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const Point_2&
result_type
operator()(const Iso_rectangle_2& r) const
{ return (r.rep().min)(); }
const Point_2&
result_type
operator()(const Segment_2& s) const
{ return (s.min)(); }
};
@ -1633,83 +1633,83 @@ namespace CommonKernelFunctors {
template <typename K>
class Construct_source_2 : Has_qrt
class Construct_source_2
{
typedef typename K::Segment_2 Segment_2;
typedef typename K::Ray_2 Ray_2;
typedef typename K::Point_2 Point_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const result_type&
result_type
operator()(const Segment_2& s) const
{ return s.rep().source(); }
const result_type&
result_type
operator()(const Ray_2& r) const
{ return r.rep().source(); }
};
template <typename K>
class Construct_source_3 : Has_qrt
class Construct_source_3
{
typedef typename K::Segment_3 Segment_3;
typedef typename K::Ray_3 Ray_3;
typedef typename K::Point_3 Point_3;
public:
typedef Point_3 result_type;
typedef const Point_3& result_type;
const result_type&
result_type
operator()(const Segment_3& s) const
{ return s.rep().source(); }
const result_type&
result_type
operator()(const Ray_3& r) const
{ return r.rep().source(); }
};
template <typename K>
class Construct_target_2 : Has_qrt
class Construct_target_2
{
typedef typename K::Segment_2 Segment_2;
typedef typename K::Point_2 Point_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const result_type&
result_type
operator()(const Segment_2& s) const
{ return s.rep().target(); }
};
template <typename K>
class Construct_target_3 : Has_qrt
class Construct_target_3
{
typedef typename K::Segment_3 Segment_3;
typedef typename K::Point_3 Point_3;
public:
typedef Point_3 result_type;
typedef const Point_3& result_type;
const result_type&
result_type
operator()(const Segment_3& s) const
{ return s.rep().target(); }
};
template <typename K>
class Construct_second_point_2 : Has_qrt
class Construct_second_point_2
{
typedef typename K::Ray_2 Ray_2;
typedef typename K::Point_2 Point_2;
public:
typedef Point_2 result_type;
typedef const Point_2& result_type;
const result_type&
result_type
operator()(const Ray_2& r) const
{ return r.rep().second_point(); }
};
template <typename K>
class Construct_second_point_3 // : Has_qrt
class Construct_second_point_3
{
typedef typename K::Ray_3 Ray_3;
typedef typename K::Point_3 Point_3;
@ -1881,7 +1881,7 @@ namespace CommonKernelFunctors {
};
template <typename K>
class Construct_vertex_3 : Has_qrt
class Construct_vertex_3
{
typedef typename K::Point_3 Point_3;
typedef typename K::Segment_3 Segment_3;
@ -1889,21 +1889,29 @@ namespace CommonKernelFunctors {
typedef typename K::Triangle_3 Triangle_3;
typedef typename K::Tetrahedron_3 Tetrahedron_3;
public:
typedef Point_3 result_type;
template<typename>
struct result {
typedef const Point_3& type;
};
const Point_3 &
template<typename T>
struct result<T(Iso_cuboid_3)> {
typedef Point_3 type;
};
typename result< Construct_vertex_3(Segment_3) >::type
operator()( const Segment_3& s, int i) const
{ return s.rep().vertex(i); }
const Point_3 &
typename result< Construct_vertex_3(Triangle_3) >::type
operator()( const Triangle_3& t, int i) const
{ return t.rep().vertex(i); }
Point_3
typename result< Construct_vertex_3(Iso_cuboid_3) >::type
operator()( const Iso_cuboid_3& r, int i) const
{ return r.rep().vertex(i); }
{ typename result< Construct_vertex_3(Iso_cuboid_3) >::type asdf; return r.rep().vertex(i); }
const Point_3 &
typename result< Construct_vertex_3(Tetrahedron_3) >::type
operator()( const Tetrahedron_3& t, int i) const
{ return t.rep().vertex(i); }
};
@ -2755,12 +2763,6 @@ namespace CommonKernelFunctors {
};
} // namespace CommonKernelFunctors
template <class K>
struct Qualified_result_of<CommonKernelFunctors::Construct_vertex_3<K>,Iso_cuboid_3<K> > :
qrt_or_not<typename CommonKernelFunctors::Construct_vertex_3<K>,false>
{};
} //namespace CGAL
#endif // CGAL_KERNEL_FUNCTION_OBJECTS_H

View File

@ -113,25 +113,25 @@ public:
return Direction_3(a(), b(), c());
}
typename Qualified_result_of<typename R::Compute_a_3, Plane_3>::type
typename boost::result_of<typename R::Compute_a_3( Plane_3)>::type
a() const
{
return R().compute_a_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_b_3, Plane_3>::type
typename boost::result_of<typename R::Compute_b_3( Plane_3)>::type
b() const
{
return R().compute_b_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_c_3, Plane_3>::type
typename boost::result_of<typename R::Compute_c_3( Plane_3)>::type
c() const
{
return R().compute_c_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_d_3, Plane_3>::type
typename boost::result_of<typename R::Compute_d_3( Plane_3)>::type
d() const
{
return R().compute_d_3_object()(*this);

View File

@ -85,26 +85,26 @@ public:
: RPoint_2(typename R::Construct_point_2()(Return_base_tag(), hx, hy, hw))
{}
typename Qualified_result_of<typename R::Compute_x_2,Point_2>::type
typename boost::result_of<typename R::Compute_x_2(Point_2)>::type
x() const
{
return typename R::Compute_x_2()(*this);
}
typename Qualified_result_of<typename R::Compute_y_2,Point_2>::type
typename boost::result_of<typename R::Compute_y_2(Point_2)>::type
y() const
{
return typename R::Compute_y_2()(*this);
}
typename Qualified_result_of<typename R::Compute_x_2,Point_2>::type
typename boost::result_of<typename R::Compute_x_2(Point_2)>::type
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y();
}
typename Qualified_result_of<typename R::Compute_x_2,Point_2>::type
typename boost::result_of<typename R::Compute_x_2(Point_2)>::type
operator[](int i) const
{
return cartesian(i);
@ -122,19 +122,19 @@ public:
typename Qualified_result_of<typename R::Compute_hx_2,Point_2>::type
typename boost::result_of<typename R::Compute_hx_2(Point_2)>::type
hx() const
{
return typename R::Compute_hx_2()(*this);
}
typename Qualified_result_of<typename R::Compute_hy_2,Point_2>::type
typename boost::result_of<typename R::Compute_hy_2(Point_2)>::type
hy() const
{
return typename R::Compute_hy_2()(*this);
}
typename Qualified_result_of<typename R::Compute_hw_2,Point_2>::type
typename boost::result_of<typename R::Compute_hw_2(Point_2)>::type
hw() const
{
return typename R::Compute_hw_2()(*this);
@ -145,7 +145,7 @@ public:
return 2;
}
typename Qualified_result_of<typename R::Compute_hx_2,Point_2>::type
typename boost::result_of<typename R::Compute_hx_2(Point_2)>::type
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -85,49 +85,49 @@ public:
: Rep(typename R::Construct_point_3()(Return_base_tag(), hx, hy, hz, hw))
{}
typename Qualified_result_of<typename R::Compute_x_3, Point_3>::type
typename boost::result_of<typename R::Compute_x_3( Point_3)>::type
x() const
{
return typename R::Compute_x_3()(*this);
}
typename Qualified_result_of<typename R::Compute_y_3, Point_3>::type
typename boost::result_of<typename R::Compute_y_3( Point_3)>::type
y() const
{
return typename R::Compute_y_3()(*this);
}
typename Qualified_result_of<typename R::Compute_z_3, Point_3>::type
typename boost::result_of<typename R::Compute_z_3( Point_3)>::type
z() const
{
return typename R::Compute_z_3()(*this);
}
typename Qualified_result_of<typename R::Compute_hx_3, Point_3>::type
typename boost::result_of<typename R::Compute_hx_3( Point_3)>::type
hx() const
{
return R().compute_hx_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hy_3, Point_3>::type
typename boost::result_of<typename R::Compute_hy_3( Point_3)>::type
hy() const
{
return R().compute_hy_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hz_3, Point_3>::type
typename boost::result_of<typename R::Compute_hz_3( Point_3)>::type
hz() const
{
return R().compute_hz_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hw_3, Point_3>::type
typename boost::result_of<typename R::Compute_hw_3( Point_3)>::type
hw() const
{
return R().compute_hw_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_x_3, Point_3>::type
typename boost::result_of<typename R::Compute_x_3( Point_3)>::type
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -146,7 +146,7 @@ public:
return hw();
}
typename Qualified_result_of<typename R::Compute_x_3,Point_3>::type
typename boost::result_of<typename R::Compute_x_3(Point_3)>::type
operator[](int i) const
{
return cartesian(i);

View File

@ -86,13 +86,13 @@ public:
: RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {}
typename Qualified_result_of<typename R_::Construct_source_2, Ray_2>::type
typename boost::result_of<typename R_::Construct_source_2( Ray_2)>::type
source() const
{
return R().construct_source_2_object()(*this);
}
typename Qualified_result_of<typename R_::Construct_second_point_2, Ray_2>::type
typename boost::result_of<typename R_::Construct_second_point_2( Ray_2)>::type
second_point() const
{
return R().construct_second_point_2_object()(*this);
@ -116,7 +116,7 @@ public:
}
typename Qualified_result_of<typename R_::Construct_source_2, Ray_2, int >::type
typename boost::result_of<typename R_::Construct_source_2( Ray_2, int )>::type
start() const
{
return source();

View File

@ -105,25 +105,25 @@ public:
bool collinear_has_on(const Point_3 &p) const;
*/
Point_3 point(int i) const // TODO : use Qrt
typename boost::result_of<typename R::Construct_point_on_3(Ray_3, int)>::type
point(int i) const // TODO : use Qrt
{
return R().construct_point_on_3_object()(*this, i);
}
// FIXME : Use Qrt
//typename Qualified_result_of<typename R_::Construct_source_3, Ray_3 >::type
Point_3
typename boost::result_of<typename R::Construct_source_3(Ray_3)>::type
source() const
{
return R().construct_source_3_object()(*this);
}
Point_3 second_point() const // TODO : use Qrt
typename boost::result_of<typename R::Construct_second_point_3(Ray_3)>::type
second_point() const
{
return R().construct_second_point_3_object()(*this);
}
Point_3 // FIXME : Use Qrt
typename boost::result_of<typename R::Construct_source_3(Ray_3)>::type
start() const
{
return source();

View File

@ -76,44 +76,44 @@ public:
Segment_2(const Point_2 &sp, const Point_2 &ep)
: RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {}
typename Qualified_result_of<typename R::Construct_source_2, Segment_2>::type
typename boost::result_of<typename R::Construct_source_2( Segment_2)>::type
source() const
{
return R_().construct_source_2_object()(*this);
}
typename Qualified_result_of<typename R::Construct_target_2, Segment_2>::type
typename boost::result_of<typename R::Construct_target_2( Segment_2)>::type
target() const
{
return R_().construct_target_2_object()(*this);
}
typename Qualified_result_of<typename R::Construct_source_2, Segment_2>::type
typename boost::result_of<typename R::Construct_source_2( Segment_2)>::type
start() const
{
return source();
}
typename Qualified_result_of<typename R::Construct_target_2, Segment_2>::type
typename boost::result_of<typename R::Construct_target_2( Segment_2)>::type
end() const
{
return target();
}
typename Qualified_result_of<typename R::Construct_min_vertex_2, Segment_2>::type
typename boost::result_of<typename R::Construct_min_vertex_2( Segment_2)>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
typename Qualified_result_of<typename R::Construct_max_vertex_2, Segment_2>::type
typename boost::result_of<typename R::Construct_max_vertex_2( Segment_2)>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
typename boost::result_of<typename R::Construct_vertex_2( Segment_2, int)>::type
vertex(int i) const;
typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
typename boost::result_of<typename R::Construct_vertex_2( Segment_2, int)>::type
point(int i) const;
typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
typename boost::result_of<typename R::Construct_vertex_2( Segment_2, int)>::type
operator[](int i) const;
bool is_horizontal() const;
@ -178,7 +178,7 @@ public:
template < class R_ >
CGAL_KERNEL_INLINE
typename Qualified_result_of<typename R_::Construct_min_vertex_2, Segment_2<R_> >::type
typename boost::result_of<typename R_::Construct_min_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
@ -187,7 +187,7 @@ Segment_2<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
template < class R_ >
CGAL_KERNEL_INLINE
typename Qualified_result_of<typename R_::Construct_max_vertex_2, Segment_2<R_> >::type
typename boost::result_of<typename R_::Construct_max_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
@ -196,7 +196,7 @@ Segment_2<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
template < class R_ >
CGAL_KERNEL_INLINE
typename Qualified_result_of<typename R_::Construct_vertex_2, Segment_2<R_>, int >::type
typename boost::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();
@ -204,7 +204,7 @@ Segment_2<R_>::vertex(int i) const
template < class R_ >
inline
typename Qualified_result_of<typename R_::Construct_vertex_2, Segment_2<R_>, int >::type
typename boost::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::point(int i) const
{
return vertex(i);
@ -212,7 +212,7 @@ Segment_2<R_>::point(int i) const
template < class R_ >
inline
typename Qualified_result_of<typename R_::Construct_vertex_2, Segment_2<R_>, int >::type
typename boost::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::operator[](int i) const
{
return vertex(i);

View File

@ -74,54 +74,44 @@ public:
Segment_3(const Point_3& sp, const Point_3& ep)
: Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {}
// FIXME TODO : Use Qrt here !
//typename Qualified_result_of<typename R::Construct_source_3, Segment_3>::type
Point_3
typename boost::result_of<typename R::Construct_source_3(Segment_3)>::type
source() const
{
return R_().construct_source_3_object()(*this);
}
//typename Qualified_result_of<typename R::Construct_target_3, Segment_3>::type
Point_3
typename boost::result_of<typename R::Construct_target_3(Segment_3)>::type
target() const
{
return R_().construct_target_3_object()(*this);
}
//typename Qualified_result_of<typename R::Construct_source_3, Segment_3>::type
Point_3
typename boost::result_of<typename R::Construct_source_3(Segment_3)>::type
start() const
{
return source();
}
//typename Qualified_result_of<typename R::Construct_target_3, Segment_3>::type
Point_3
typename boost::result_of<typename R::Construct_target_3(Segment_3)>::type
end() const
{
return target();
}
//typename Qualified_result_of<typename R::Construct_min_vertex_2, Segment_2>::type
Point_3
typename boost::result_of<typename R::Construct_min_vertex_3(Segment_3)>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
//typename Qualified_result_of<typename R::Construct_max_vertex_2, Segment_2>::type
Point_3
typename boost::result_of<typename R::Construct_max_vertex_3(Segment_3)>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
//typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type
vertex(int i) const;
//typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type
point(int i) const
{ return vertex(i); }
//typename Qualified_result_of<typename R::Construct_vertex_2, Segment_2, int>::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type
operator[](int i) const
{ return vertex(i); }
@ -179,8 +169,7 @@ public:
template < class R_ >
CGAL_KERNEL_INLINE
//typename Qualified_result_of<typename R_::Construct_min_vertex_2, Segment_2<R_> >::type
typename R_::Point_3
typename boost::result_of<typename R_::Construct_min_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
@ -189,8 +178,7 @@ Segment_3<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
template < class R_ >
CGAL_KERNEL_INLINE
//typename Qualified_result_of<typename R_::Construct_max_vertex_2, Segment_2<R_> >::type
typename R_::Point_3
typename boost::result_of<typename R_::Construct_max_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
@ -199,8 +187,7 @@ Segment_3<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
template < class R_ >
CGAL_KERNEL_INLINE
//typename Qualified_result_of<typename R_::Construct_vertex_2, Segment_2<R_>, int >::type
typename R_::Point_3
typename boost::result_of<typename R_::Construct_vertex_3( Segment_3<R_>, int ) >::type
Segment_3<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();

View File

@ -94,9 +94,7 @@ public:
Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const;
// FIXME : why doesn't Qrt work here ? We loose optimization !
//typename Qualified_result_of<typename R::Construct_center_3, Sphere_3>::type
Point_3_
typename boost::result_of<typename R::Construct_center_3( Sphere_3)>::type
center() const
{
return R().construct_center_3_object()(*this);

View File

@ -78,16 +78,13 @@ public:
t.transform(this->vertex(3)));
}
// FIXME TODO : Why doesn't Qrt work here ???
//typename Qualified_result_of<typename R::Construct_vertex_3, Tetrahedron_3, int>::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type
vertex(int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
//typename Qualified_result_of<typename R::Construct_vertex_3, Tetrahedron_3, int>::type
Point_3
typename boost::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type
operator[](int i) const
{
return vertex(i);
@ -139,7 +136,7 @@ public:
return R().has_on_unbounded_side_3_object()(*this, p);
}
typename Qualified_result_of<typename R::Compute_volume_3, Tetrahedron_3>::type
typename boost::result_of<typename R::Compute_volume_3( Tetrahedron_3)>::type
volume() const
{
return R().compute_volume_3_object()(*this);

View File

@ -107,13 +107,13 @@ public:
return !(*this == t);
}
typename Qualified_result_of<typename R::Construct_vertex_2, Triangle_2, int>::type
typename boost::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
vertex(int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename Qualified_result_of<typename R::Construct_vertex_2, Triangle_2, int>::type
typename boost::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
operator[](int i) const
{
return vertex(i);

View File

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

View File

@ -99,26 +99,26 @@ public:
: RVector_2(typename R::Construct_vector_2()(Return_base_tag(), x,y,w)) {}
typename Qualified_result_of<typename R::Compute_x_2,Vector_2>::type
typename boost::result_of<typename R::Compute_x_2(Vector_2)>::type
x() const
{
return R().compute_x_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type
typename boost::result_of<typename R::Compute_y_2(Vector_2)>::type
y() const
{
return R().compute_y_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_y_2,Vector_2>::type
typename boost::result_of<typename R::Compute_y_2(Vector_2)>::type
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y();
}
typename Qualified_result_of<typename R::Compute_x_2,Vector_2>::type
typename boost::result_of<typename R::Compute_x_2(Vector_2)>::type
operator[](int i) const
{
return cartesian(i);
@ -134,26 +134,26 @@ public:
return typename R::Construct_cartesian_const_iterator_2()(*this,2);
}
typename Qualified_result_of<typename R::Compute_hx_2,Vector_2>::type
typename boost::result_of<typename R::Compute_hx_2(Vector_2)>::type
hx() const
{
return R().compute_hx_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hy_2,Vector_2>::type
typename boost::result_of<typename R::Compute_hy_2(Vector_2)>::type
hy() const
{
return R().compute_hy_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hw_2,Vector_2>::type
typename boost::result_of<typename R::Compute_hw_2(Vector_2)>::type
hw() const
{
return R().compute_hw_2_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hx_2,Vector_2>::type
typename boost::result_of<typename R::Compute_hx_2(Vector_2)>::type
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -133,49 +133,49 @@ public:
return R().construct_divided_vector_3_object()(*this,c);
}
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
typename boost::result_of<typename R::Compute_x_3(Vector_3)>::type
x() const
{
return R().compute_x_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_y_3, Vector_3>::type
typename boost::result_of<typename R::Compute_y_3(Vector_3)>::type
y() const
{
return R().compute_y_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_z_3, Vector_3>::type
typename boost::result_of<typename R::Compute_z_3(Vector_3)>::type
z() const
{
return R().compute_z_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hx_3, Vector_3>::type
typename boost::result_of<typename R::Compute_hx_3(Vector_3)>::type
hx() const
{
return R().compute_hx_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hy_3, Vector_3>::type
typename boost::result_of<typename R::Compute_hy_3(Vector_3)>::type
hy() const
{
return R().compute_hy_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hz_3, Vector_3>::type
typename boost::result_of<typename R::Compute_hz_3(Vector_3)>::type
hz() const
{
return R().compute_hz_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
typename boost::result_of<typename R::Compute_hw_3(Vector_3)>::type
hw() const
{
return R().compute_hw_3_object()(*this);
}
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
typename boost::result_of<typename R::Compute_x_3(Vector_3)>::type
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -184,7 +184,7 @@ public:
return z();
}
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
typename boost::result_of<typename R::Compute_hw_3(Vector_3)>::type
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
@ -199,7 +199,7 @@ public:
return 3;
}
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
typename boost::result_of<typename R::Compute_x_3(Vector_3)>::type
operator[](int i) const
{
return cartesian(i);
@ -215,7 +215,7 @@ public:
return typename R::Construct_cartesian_const_iterator_3()(*this,3);
}
typename Qualified_result_of<typename R::Compute_squared_length_3, Vector_3>::type
typename boost::result_of<typename R::Compute_squared_length_3(Vector_3)>::type
squared_length() const
{
return R().compute_squared_length_3_object()(*this);

View File

@ -41,7 +41,6 @@
#include <CGAL/enum.h>
#include <CGAL/aff_transformation_tags.h>
#include <CGAL/Object.h>
#include <CGAL/Qualified_result_of.h>
#include <CGAL/Kernel_traits.h>
#endif // CGAL_KERNEL_BASIC_H

View File

@ -37,10 +37,10 @@ void _test_construct_radical_line(const K &k) {
typedef typename K::Construct_circle_2 Construct_circle_2;
typedef typename K::Construct_radical_line_2 Construct_radical_line_2;
Intersect_2 theIntersect_2 = k.intersect_2_object();
// Intersect_2 theIntersect_2 = k.intersect_2_object();
Construct_circle_2 theConstruct_circle_2 = k.construct_circle_2_object();
Construct_radical_line_2 theConstruct_radical_line_2 = k.construct_radical_line_2_object();
Has_on_2 theHas_on_2 = k.has_on_2_object();
// Has_on_2 theHas_on_2 = k.has_on_2_object();
std::cout << "Testing radical_line(Circle,Circle)..." << std::endl;
Circle_2 s = theConstruct_circle_2(Point_2(0,0),1);

View File

@ -100,6 +100,7 @@ _test_cls_iso_cuboid_3(const R& )
assert( (r2.max)() == p3 );
assert( r1.vertex(0) == p1 );
assert( r1[0] == p1 );
assert( r1.vertex(1) == p5 );
assert( r1.vertex(2) == p10);
assert( r1.vertex(3) == p11);

View File

@ -71,6 +71,10 @@ min_n(const T& t0, const T& t1, const T& t2, const T& t3, const T& t4,
{ return (std::min)(t0, min_n(t1, t2, t3, t4, t5, t6, t7)); }
template<typename T> inline
const T&
max_n(const T& t) { return t; }
template < typename T > inline
const T&
max_n(const T& t0, const T& t1)