Code can be upgraded by using either boost::get
or the boost::static_visitor<T>
.
#include <CGAL/intersections.h>
template<typename R>
struct Intersection_visitor : public boost::static_visitor<> {
void operator()(const Point_2& p) const
{
}
void operator()(const Segment_2& s) const
{
}
};
template <class R>
void foo(Segment_2<R> seg, Line_2<R> lin)
{
if(const Point_2* foo = object_cast<Point_2>(&obj)) {
} else if(const Segment_2* foo = object_cast<Segment_2>(&obj)) {
} else {
}
if(result) {
if(const Point_2* foo = boost::get<Point_2>(&*obj)) {
} else if(const Segment_2* foo = boost::get<Segment_2>(&*obj)) {
}
} else {
}
if(result) { boost::apply_visitor(Intersection_visitor(), *result); }
else {
}
}