diff --git a/Cartesian_kernel/include/CGAL/Cartesian.h b/Cartesian_kernel/include/CGAL/Cartesian.h index 41af5cf7b48..3f5de1d9dd7 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian.h +++ b/Cartesian_kernel/include/CGAL/Cartesian.h @@ -51,6 +51,9 @@ struct Cartesian_base_ref_count #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) #include + + template + struct Intersection_result : CGAL::Intersection_traits {}; }; template < typename FT_ > diff --git a/Cartesian_kernel/include/CGAL/Simple_cartesian.h b/Cartesian_kernel/include/CGAL/Simple_cartesian.h index 13a6160d241..c107e8b82a7 100644 --- a/Cartesian_kernel/include/CGAL/Simple_cartesian.h +++ b/Cartesian_kernel/include/CGAL/Simple_cartesian.h @@ -50,6 +50,9 @@ struct Cartesian_base_no_ref_count #define CGAL_Kernel_cons(Y,Z) CGAL_Kernel_pred(Y,Z) #include + + template + struct Intersection_result : CGAL::Intersection_traits {}; }; template < typename FT_ > diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h index 571828329d7..fb7e0cf9a02 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2.h @@ -80,9 +80,11 @@ struct Circular_kernel_base_ref_count: public LinearKernelBase #include - typedef LinearFunctors::Construct_line_2 Construct_line_2; + typedef LinearFunctors::Construct_line_2 Construct_line_2; Construct_line_2 construct_line_2_object() const { return Construct_line_2(); } + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } // namespace internal diff --git a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h index 9eb6f6d0ff3..0f0d5a37122 100644 --- a/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Filtered_bbox_circular_kernel_2.h @@ -65,6 +65,8 @@ struct Filtered_bbox_circular_kernel_base_ref_count : public CircularKernel #include + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } // namespace internal diff --git a/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h index 389a1dc5e61..160ffc9925f 100644 --- a/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h +++ b/Circular_kernel_2/include/CGAL/Simple_circular_kernel_2.h @@ -74,6 +74,9 @@ struct Circular_kernel_base_ref_count: public LinearKernelBase #define CGAL_Circular_Kernel_cons(Y,Z) CGAL_Circular_Kernel_pred(Y,Z) #include + + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } // namespace internal diff --git a/Circular_kernel_3/include/CGAL/Simple_spherical_kernel_3.h b/Circular_kernel_3/include/CGAL/Simple_spherical_kernel_3.h index 17b505a8c30..4d963dbf42a 100644 --- a/Circular_kernel_3/include/CGAL/Simple_spherical_kernel_3.h +++ b/Circular_kernel_3/include/CGAL/Simple_spherical_kernel_3.h @@ -68,6 +68,9 @@ namespace CGAL { #include + + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } // namespace internal diff --git a/Circular_kernel_3/include/CGAL/Spherical_kernel_3.h b/Circular_kernel_3/include/CGAL/Spherical_kernel_3.h index 9e40c310bca..743acec9e96 100644 --- a/Circular_kernel_3/include/CGAL/Spherical_kernel_3.h +++ b/Circular_kernel_3/include/CGAL/Spherical_kernel_3.h @@ -66,6 +66,9 @@ namespace CGAL { Y Z(const CGAL::Sphere_3& S) const { return Y(S); } #include + + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } // namespace internal diff --git a/Filtered_kernel/examples/Filtered_kernel/Cartesian_I.h b/Filtered_kernel/examples/Filtered_kernel/Cartesian_I.h index 06899ea1bd0..be5e4821f2e 100644 --- a/Filtered_kernel/examples/Filtered_kernel/Cartesian_I.h +++ b/Filtered_kernel/examples/Filtered_kernel/Cartesian_I.h @@ -93,7 +93,8 @@ struct Cartesian_base_ref_count_I intersect_with_iterators_2_object) #include - + template + struct Intersection_result : CGAL::Intersection_traits {}; }; template < typename FT_ > diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h index 6fc61d70e98..9bc233e2320 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h @@ -156,6 +156,8 @@ struct Homogeneous_base #include + template + struct Intersection_result : CGAL::Intersection_traits {}; }; } //namespace CGAL diff --git a/Kernel_23/doc_tex/Kernel_23/predicates_constructions.tex b/Kernel_23/doc_tex/Kernel_23/predicates_constructions.tex index eb076e26ff1..fec99377315 100644 --- a/Kernel_23/doc_tex/Kernel_23/predicates_constructions.tex +++ b/Kernel_23/doc_tex/Kernel_23/predicates_constructions.tex @@ -66,12 +66,12 @@ especially integer types and rationals. Some functions can return different types of objects. To achieve this in a type safe way {\cgal} uses return values of \ccStyle{boost::optional< boost::variant< T \ldots\ >} were -T\textellipsis\ is a list of all possible resulting geometric objects. +T... is a list of all possible resulting geometric objects. The exact result type of an intersection can be determined by using the -\ccStyle{Intersection_traits} class. +metafunction \ccc{Kernel::Intersection_result}. \ccExample -In the following example, the traits class is used to provide the return value for the +In the following example, the metafunction is used to provide the return value for the \ccHtmlNoLinksFrom{intersection} computation: \ccHtmlLinksOff% @@ -85,8 +85,7 @@ In the following example, the traits class is used to provide the return value f std::cin >> segment_1 >> segment_2; - /* IT is an alias for Intersection_traits */ - IT< K, Segment_2, Segment_2>::result_type + K::Intersection_result::result_type v = intersection(s1, s2); if(v) { /* not empty */ diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Filtered_predicate.tex b/Kernel_23/doc_tex/Kernel_23_ref/Filtered_predicate.tex index 497c196caae..3f2804f44ee 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/Filtered_predicate.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/Filtered_predicate.tex @@ -53,6 +53,6 @@ It uses the fast but inexact predicate based on interval arithmetic for filtering and the slow but exact predicate based on multi-precision floats when the filtering predicate fails. -\ccIncludeExampleCode{Filtered_kernel/Filtered_predicate.cpp} +%% \ccIncludeExampleCode{Filtered_kernel/Filtered_predicate.cpp} \end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Kernel.tex b/Kernel_23/doc_tex/Kernel_23_ref/Kernel.tex index 0ce9097582a..e2a7d662ecc 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/Kernel.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/Kernel.tex @@ -52,6 +52,8 @@ number type is used such as within the filtering kernels, in which case it is \ccNestedType{Bounded_side}{\ccc{CGAL::Bounded_side} or \ccc{Uncertain}} \ccGlue \ccNestedType{Angle}{\ccc{CGAL::Angle} or \ccc{Uncertain}} +\ccGlue +\ccNestedType{Intersection_result}{a model of \ccc{Kernel::Intersection_result}} \ccConstants diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_2.tex b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_2.tex index 215411a6859..1db607afeff 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_2.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_2.tex @@ -3,18 +3,18 @@ A model for this must provide \ccCreationVariable{fo} -\ccMemberFunction{Intersection_traits, Type2>::result_type operator()(Type1 obj1, Type2 obj2);} +\ccMemberFunction{Kernel::Intersection_result::result_type operator()(Type1 obj1, Type2 obj2);} {computes the \ccHtmlNoLinksFrom{intersection} region of two geometrical objects of type \ccStyle{Type1} and \ccStyle{Type2}} -The function is only defined for \ccStyle{Type} and \ccStyle{Type2} -when \ccStyle{Intersection_traits::result_type} is also defined. +The function is only defined for \ccStyle{Type1} and \ccStyle{Type2} +when \ccStyle{Kernel::Intersection_result::result_type} is also defined. \ccRefines \ccc{AdaptableFunctor} (with two arguments) \ccSeeAlso \ccRefIdfierPage{CGAL::intersection}\\ +\ccRefIdfierPage{CGAL::Kernel::Intersection_result}\\ \end{ccRefFunctionObjectConcept} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_3.tex b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_3.tex index 519a08aa2d6..ce6a91378b3 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_3.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_Intersect_3.tex @@ -3,19 +3,18 @@ A model for this must provide \ccCreationVariable{fo} -\ccMemberFunction{Intersection_traits, Type2>::result_type operator()(Type1 obj1, Type2 obj2);} -{computes the \ccHtmlNoLinksFrom{intersection} region of two geometrical -objects of type \ccStyle{Type1} and \ccStyle{Type2}} +\ccMemberFunction{Kernel::Intersection_result::result_type operator()(Type1 obj1, Type2 obj2);} +{computes the \ccHtmlNoLinksFrom{intersection} region of two geometrical objects of type +\ccStyle{Type1} and \ccStyle{Type2}} -The function is only defined for \ccStyle{Type} and \ccStyle{Type2} -when \ccStyle{Intersection_traits::result_type} is also defined. +The function is only defined for \ccStyle{Type1} and \ccStyle{Type2} +when \ccStyle{Kernel::Intersection_result::result_type} is also defined. \ccRefines \ccc{AdaptableFunctor} (with two or three arguments) \ccSeeAlso \ccRefIdfierPage{CGAL::intersection}\\ -\ccRefIdfierPage{CGAL::Intersection_traits, B>}\\ +\ccRefIdfierPage{CGAL::Kernel::Intersection_result}\\ \end{ccRefFunctionObjectConcept} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/intersection.tex b/Kernel_23/doc_tex/Kernel_23_ref/intersection.tex index fe7ce2f8322..604ac53f031 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/intersection.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/intersection.tex @@ -8,13 +8,13 @@ described below. The \ccStyle{intersection} function used to return \ccStyle{CGAL::Object} but starting with {\cgal} VERSION HERE the -return type is determined by a dedicated traits class. To preserve -backwards compatibility \ccStyle{CGAL::Object} can be constructed from -the new return types implicitly, but switching to the new style is -advocated. To enable the old style without any overhead, the macro -\ccc{CGAL_INTERSECTION_VERSION} can be defined to \ccStyle{1} before -any {\cgal} header is included or through your particular build -system. +return type is determined by a metafunction defined by the kernel. To +preserve backwards compatibility \ccStyle{CGAL::Object} can be +constructed from the new return types implicitly, but switching to the +new style is advocated. To enable the old style without any overhead, +the macro \ccc{CGAL_INTERSECTION_VERSION} can be defined to +\ccStyle{1} before any {\cgal} header is included or through your +particular build system. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph{With the basic 2D and 3D Kernel} (see Chapter~\ref{chapter-kernel-23}) @@ -23,7 +23,7 @@ system. \ccUnchecked{ \ccRefLabel{Kernel::intersection} -\ccFunction{IT::result_type intersection(Type1 obj1, Type2 obj2);} +\ccFunction{Kernel::Intersection_result::result_type intersection(Type1 obj1, Type2 obj2);} {Two objects \ccStyle{obj1} and \ccStyle{obj2} intersect if there is a point \ccStyle{p} that is part of both \ccStyle{obj1} and \ccStyle{obj2}. The \ccHtmlNoLinksFrom{intersection} region of those two objects is defined as the set of all @@ -39,7 +39,7 @@ The same functionality is also available through the functors \ccc{Kernel::Inter The possible values for types \ccStyle{Type1} and \ccStyle{Type2} and the value for T\ldots in \ccStyle{boost::optional< boost::variant< T\ldots >} are the following and can be obtained through -\ccc{Intersection_traits, B>}: +\ccc{Kernel::Intersection_result}: \begin{ccTexOnly} \begin{longtable}[c]{|l|l|l|} @@ -512,7 +512,7 @@ with \ccc{CGAL::Dispatch_output_iterator}. Since both the number of intersections, if any, and their type, depend on the arguments, the function expects an output -iterator on \ccc{Intersection_Traits, Type2>}, as presented below. +iterator on \ccc{K::Intersection_result}, as presented below. \ccFunction{template < class OutputIterator > OutputIterator @@ -559,7 +559,7 @@ with \ccc{CGAL::Dispatch_output_iterator}. Since both the number of intersections, if any, and their type, depend on the arguments, the functions expects an output -iterator on \ccStyle{Intersection_Traits, Type2}, as presented below. +iterator on \ccStyle{Kernel::Intersection_result}, as presented below. The \textbf{first function} is: @@ -651,7 +651,7 @@ struct Intersection_visitor { template void foo(Segment_2 seg, Line_2 lin) { - ITd< R, Segment_2, Line_2 >::result_type result = intersection(seg, lin); + R::template Intersection_result, Line_2 >::result_type result = intersection(seg, lin); if(result) { boost::apply_visitor(Intersection_visitor(), *result); } else { /* no intersection */ } } @@ -665,6 +665,7 @@ and~\ref{chapter-spherical-kernel}. \ccSeeAlso \ccRefIdfierPage{CGAL::do_intersect}, \\ +\ccRefIdfierPage{CGAL::Kernel::Intersection_result}, \\ \ccRefIdfierPage{CGAL::Intersection_traits, B>}, \\ \ccRefIdfierPage{CGAL_INTERSECTION_VERSION}, \\ \ccAnchor{www.boost.org/doc/libs/release/libs/optional/index.html}{boost::optional}, \\ diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 0a9bbd460c7..24da04a8e42 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2524,7 +2524,7 @@ namespace CommonKernelFunctors { #if CGAL_INTERSECTION_VERSION < 2 result_type #else - typename Intersection_traits< K, T1, T2>::result_type + typename K::template Intersection_result< T1, T2 >::result_type #endif operator()(const T1& t1, const T2& t2) const { return internal::intersection(t1, t2, K()); } @@ -2544,7 +2544,7 @@ namespace CommonKernelFunctors { #if CGAL_INTERSECTION_VERSION < 2 result_type #else - typename Intersection_traits< K, T1, T2>::result_type + typename K::template Intersection_result< T1, T2 >::result_type #endif operator()(const T1& t1, const T2& t2) const { return internal::intersection(t1, t2, K() ); }