#ifndef CGAL_KD_KO_CONVERTER_H #define CGAL_KD_KO_CONVERTER_H #include #include #include // First_if_different namespace CGAL { template struct KO_converter; //TODO: It would probably be better if this was a Misc Functor in K1. // This way K1 could chose how it wants to present its points (sparse // iterator?) and derived classes would inherit it. namespace internal { template struct Point_converter_help { typedef typename K1::template Type::type argument_type; typedef typename K2::template Type::type result_type; template result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { typename K1::template Functor >::type i(k1); typename K2::template Functor >::type cp(k2); return cp(conv(i(p,Begin_tag())),conv(i(p,End_tag()))); } }; #ifdef CGAL_CXX0X // This doesn't seem so useful, the compiler should be able to handle // the iterators just as efficiently. template struct Point_converter_help,K1,K2> { typedef typename K1::template Type::type argument_type; typedef typename K2::template Type::type result_type; template result_type help(Indices, K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { typename K1::template Functor::type cc(k1); typename K2::template Functor >::type cp(k2); return cp(conv(cc(p,I))...); } template result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& p) const { return help(typename N_increasing_indices::type(),k1,k2,conv,p); } }; #endif } template struct KO_converter : internal::Point_converter_help {}; template struct KO_converter{ typedef typename K1::template Type::type K1_Vector; // Disabling is now done in KernelD_converter // // can't use vector without at least a placeholder point because of this // typedef typename K1::template Type< Point_tag>::type K1_Point; // typedef typename First_if_different::Type argument_type; typedef K1_Vector argument_type; typedef typename K2::template Type::type result_type; template result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& v) const { typename K1::template Functor >::type i(k1); typename K2::template Functor >::type cp(k2); return cp(conv(i(v,Begin_tag())),conv(i(v,End_tag()))); } }; template struct KO_converter{ typedef typename K1::template Type::type argument_type; typedef typename K2::template Type::type result_type; template result_type operator()(K1 const& k1, K2 const& k2, C const& conv, argument_type const& s) const { typename K1::template Functor::type f(k1); typename K2::template Functor >::type cs(k2); return cs(conv(f(s,0)),conv(f(s,1))); } }; } #endif