Fixed Kernel_d doc to compile again and to use result_of for

intersections.
This commit is contained in:
Philipp Möller 2012-05-02 10:08:28 +00:00
parent 9bb495b4bd
commit 17e00293d1
3 changed files with 11 additions and 8 deletions

View File

@ -83,7 +83,7 @@ for more information about this mechanism.
Segment s1, s2; Segment s1, s2;
std::cin >> s1 >> s2; std::cin >> s1 >> s2;
boost::result_of<K::Intersect_2(Segment, Segment)>::type boost::result_of<K::Intersect_d(Segment, Segment)>::type
v = intersection(s1, s2); v = intersection(s1, s2);
if(v) { if(v) {
/* not empty */ /* not empty */

View File

@ -3,10 +3,7 @@ A model for this must provide:
\ccCreationVariable{fo} \ccCreationVariable{fo}
\ccMemberFunction{ \ccMemberFunction{boost::result_of<Kernel::Intersect_d(Type1<K>, Type2<K>)>::type operator()(const Type1<K>& p, const Type2<K>& q);}
typename
boost::result_of<Kernel::Intersect_d(Type1<K>, Type2<K>)>::type
operator()(const Type1<K>& p, const Type2<K>& q);}
{returns the result of the intersection of $p$ and $q$ in form of a {returns the result of the intersection of $p$ and $q$ in form of a
polymorphic object. \ccc{Kernel_object} may be any of polymorphic object. \ccc{Kernel_object} may be any of
\ccc{Kernel::Segment_d}, \ccc{Kernel::Ray_d}, \ccc{Kernel::Line_d}, \ccc{Kernel::Segment_d}, \ccc{Kernel::Ray_d}, \ccc{Kernel::Line_d},

View File

@ -1,7 +1,7 @@
\begin{ccRefFunction}{intersection} \begin{ccRefFunction}{intersection}
\ccInclude{CGAL/intersections_d.h} \ccInclude{CGAL/intersections_d.h}
\ccFunction{Kernel::Intersect_d::Result<Type1<K>, Type2<K> >::Type \ccFunction{result_of<Kernel::Intersect_d(Type1<K>, Type2<K>) >::type
intersection(Type1<R> f1, Type2<R> f2);} { returns the intersection intersection(Type1<R> f1, Type2<R> f2);} { returns the intersection
result of $f1$ and $f2$. result of $f1$ and $f2$.
\ccPrecond The objects are of the same dimension.} \ccPrecond The objects are of the same dimension.}
@ -162,8 +162,13 @@ struct Intersection_visitor {
template <class R> template <class R>
void foo(Segment_d<R> seg, Line_d<R> lin) void foo(Segment_d<R> seg, Line_d<R> lin)
{ {
R::Intersect_d::template Result< Segment_d<R>, Line_d<R> > // with C++11 support
result = intersection(seg, lin); auto result = intersection(seg, lin);
// without C++11 support
// typename boost::result_of<R::Intersect_d(Segment_d<R>, Line_d<R>)>::type
// result = intersection(seg, lin);
if(result) { boost::apply_visitor(Intersection_visitor<R>(), *result); } if(result) { boost::apply_visitor(Intersection_visitor<R>(), *result); }
else { /* no intersection */ } else { /* no intersection */ }
} }
@ -176,6 +181,7 @@ void foo(Segment_d<R> seg, Line_d<R> lin)
\ccc{Kernel::Do_intersect_d}, \\ \ccc{Kernel::Do_intersect_d}, \\
\ccAnchor{http://www.boost.org/doc/libs/release/libs/optional/index.html}{boost::optional}, \\ \ccAnchor{http://www.boost.org/doc/libs/release/libs/optional/index.html}{boost::optional}, \\
\ccAnchor{http://www.boost.org/doc/html/variant.html}{boost::variant} \\ \ccAnchor{http://www.boost.org/doc/html/variant.html}{boost::variant} \\
\ccAnchor{http://www.boost.org/libs/utility/utility.htm#result_of}{boost::result\_of}
\end{ccRefFunction} \end{ccRefFunction}