#ifndef CGAL_KD_DEFINE_SEGMENT_H #define CGAL_KD_DEFINE_SEGMENT_H #include #include #include #include namespace CGAL { namespace CartesianDKernelFunctors { template struct Construct_segment { CGAL_FUNCTOR_INIT_IGNORE(Construct_segment) typedef R_ R; typedef typename R_::Point Point; typedef typename R_::Segment Segment; typedef typename R_::template Functor >::type CP; typedef Segment result_type; result_type operator()(Point const&a, Point const&b)const{ return result_type(a,b); } // T should only be std::piecewise_construct_t, but we shouldn't fail if it doesn't exist. template result_type operator()(CGAL_FORWARDABLE(T),CGAL_FORWARDABLE(U) u,CGAL_FORWARDABLE(V) v)const{ CP cp(this->kernel()); result_type r = {{ call_on_tuple_elements(cp, CGAL_FORWARD(U,u)), call_on_tuple_elements(cp, CGAL_FORWARD(V,v)) }}; return r; } }; // This should be part of Construct_point, according to Kernel_23 conventions template struct Segment_extremity { CGAL_FUNCTOR_INIT_IGNORE(Segment_extremity) typedef R_ R; typedef typename R_::Point Point; typedef typename R_::Segment Segment; typedef Point result_type; result_type operator()(Segment const&s, int i)const{ if(i==0) return s.source(); CGAL_assertion(i==1); return s.target(); } #ifdef CGAL_CXX0X result_type operator()(Segment &&s, int i)const{ if(i==0) return std::move(s.source()); CGAL_assertion(i==1); return std::move(s.target()); } #endif }; } // CartesianDKernelFunctors template struct Define_segment : public Base_ { typedef Base_ Base; typedef Define_segment Self; typedef typename Default::Get::type Derived; typedef CGAL::Segment Segment; typedef typename Base::Object_list::template add::type Object_list; // TODO: forward the second Functor argument (like fast, no_filter) template struct Functor : Base_::template Functor {}; template struct Functor,D> { typedef CartesianDKernelFunctors::Construct_segment type; }; template struct Functor { typedef CartesianDKernelFunctors::Segment_extremity type; }; }; } #endif