diff --git a/.gitattributes b/.gitattributes index 07d591ed6b6..18afe266bbc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -476,7 +476,7 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_d Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h -text Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h -text Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h -text -Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_point_location.h -text +Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h -text Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h -text Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h -text Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h -text diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h index 2415b1dfb03..034b4bc572a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h @@ -27,14 +27,11 @@ //#define CGAL_DEBUG_LM -#include +#include #include #include -#include #include -#include -#include namespace CGAL { @@ -69,23 +66,20 @@ public: typedef typename Arrangement_2::Ccb_halfedge_const_circulator Ccb_halfedge_const_circulator; typedef typename Arrangement_2::Outer_ccb_const_iterator - Outer_ccb_const_iterator; + Outer_ccb_const_iterator; typedef typename Arrangement_2::Inner_ccb_const_iterator - Inner_ccb_const_iterator; + Inner_ccb_const_iterator; typedef typename Arrangement_2::Isolated_vertex_const_iterator Isolated_vertex_const_iterator; typedef typename Arrangement_2::Point_2 Point_2; typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif + typedef Arr_point_location_result Result; + typedef typename Result::Type Result_type; + + // Support boost::result_of + typedef Result_type result_type; protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; @@ -100,25 +94,6 @@ protected: typedef std::set Halfedge_set; - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 - // Data members: const Arrangement_2* p_arr; // The associated arrangement. const Traits_adaptor_2* m_traits; // Its associated traits object. @@ -126,6 +101,10 @@ protected: bool own_gen; // Indicates whether the generator // has been locally allocated. + template + Result_type result_return(T t) const { return Result()(t); } + inline Result_type result_return() const { return Result()(); } + public: /*! Default constructor. */ Arr_landmarks_point_location() : diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h index 9da45a9f0c9..1dca5ca910d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h @@ -22,12 +22,8 @@ #ifndef CGAL_ARR_NAIVE_POINT_LOCATION_H #define CGAL_ARR_NAIVE_POINT_LOCATION_H -#include +#include #include -#include - -#include -#include /*! \file * Definition of the Arr_naive_point_location template. @@ -55,44 +51,25 @@ public: typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif + typedef Arr_point_location_result Result; + typedef typename Result::Type Result_type; + + // Support boost::result_of + typedef Result_type result_type; protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 - // Data members: const Arrangement_2* p_arr; // The associated arrangement. const Traits_adaptor_2* geom_traits; // Its associated geometry traits. const Topology_traits* top_traits; // Its associated topology traits. + template + Result_type result_return(T t) const { return Result()(t); } + inline Result_type result_return() const { return Result()(); } + public: - /*! Default constructor. */ Arr_naive_point_location() : p_arr(NULL), @@ -101,8 +78,7 @@ public: {} /*! Constructor given an arrangement. */ - Arr_naive_point_location(const Arrangement_2& arr) : - p_arr(&arr) + Arr_naive_point_location(const Arrangement_2& arr) : p_arr(&arr) { geom_traits = static_cast(p_arr->geometry_traits()); top_traits = p_arr->topology_traits(); @@ -131,7 +107,7 @@ public: * query point. This object is either a Face_const_handle or a * Halfedge_const_handle or a Vertex_const_handle. */ - result_type locate(const Point_2& p) const; + Result_type locate(const Point_2& p) const; }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h index e59400d1c64..dfccfa2644c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h @@ -16,13 +16,14 @@ // // Author(s) : Idit Haran // Ron Wein + #ifndef CGAL_ARR_LANDMARKS_GENERATOR_H #define CGAL_ARR_LANDMARKS_GENERATOR_H /*! \file * Definition of the Arr_landmarks_generator_base template. */ -#include +#include #include #include #include @@ -31,8 +32,6 @@ #include #include #include -#include -#include namespace CGAL { @@ -72,14 +71,8 @@ public: typedef std::vector Points_set; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object PL_result_type; -#else - typedef typename boost::variant PL_variant_type; - typedef typename boost::optional PL_result_type; -#endif + typedef Arr_point_location_result PL_result; + typedef typename PL_result::Type PL_result_type; typedef std::pair PL_pair; typedef std::vector Pairs_set; @@ -92,24 +85,6 @@ private: protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object pl_result_return(T t) const { return CGAL::make_object(t); } - inline CGAL::Object pl_result_return() const { return CGAL::Object(); } -#else - template - inline PL_result_type pl_result_return(T t) const { return PL_result_type(t); } - - inline PL_result_type pl_result_return() const { return PL_result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 - // Data members: const Traits_adaptor_2* m_traits; // The associated traits object. Nearest_neighbor nn; // The associated nearest neighbor object. @@ -117,6 +92,10 @@ protected: bool updated; int num_small_not_updated_changes; + template + PL_result_type pl_result_return(T t) { return PL_result()(t); } + inline PL_result_type pl_result_return() { return PL_result()(); } + public: bool is_empty() const { return nn.is_empty(); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h index d7230f99eba..c0a7384b69a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -43,25 +43,19 @@ namespace CGAL { template class Arr_landmarks_nearest_neighbor { public: - typedef Arrangement_ Arrangement_2; + typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; + typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement_2::Face_const_handle Face_const_handle; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object PL_result_type; -#else - typedef typename boost::variant PL_variant_type; - typedef typename boost::optional PL_result_type; -#endif + typedef Arr_point_location_result PL_result; + typedef typename PL_result::Type PL_result_type; - typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; + typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; typedef typename Geometry_traits_2::Approximate_number_type - Approximate_number_type; - typedef typename Geometry_traits_2::Point_2 Point_2; + Approximate_number_type; + typedef typename Geometry_traits_2::Point_2 Point_2; /*! \class NN_Point_2 * Stores a point along with its approximate coordinates and its location diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h index d535b05409e..bef63c22608 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h @@ -33,7 +33,7 @@ namespace CGAL { // Locate the arrangement feature containing the given point. // template -typename Arr_naive_point_location::result_type +typename Arr_naive_point_location::Result_type Arr_naive_point_location::locate(const Point_2& p) const { // Go over the arrangement vertices and check whether one of them equals diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_point_location.h deleted file mode 100644 index 4831f44dc0e..00000000000 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_point_location.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2012 Tel-Aviv University (Israel). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL: $ -// $Id: $ -// -// -// Author(s) : Efi Fogel - -#ifndef CGAL_ARR_POINT_LOCATION_H -#define CGAL_ARR_POINT_LOCATION_H - -// The macro CGAL_POINT_LOCATION_VERSION controls which version of the -// point location is used. Currently two values are supported: -// 1. Point location with CGAL::Object -// 2. Point location with boost::optional > -// The default value is 2. - -#if !defined(CGAL_POINT_LOCATION_VERSION) -#define CGAL_POINT_LOCATION_VERSION 2 -#endif - -namespace CGAL { - -} //namespace CGAL - -#endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h new file mode 100644 index 00000000000..b0d6a121048 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location_result.h @@ -0,0 +1,80 @@ +// Copyright (c) 2012 Tel-Aviv University (Israel). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: $ +// $Id: $ +// +// +// Author(s) : Efi Fogel + +#ifndef CGAL_ARR_POINT_LOCATION_RESULT_H +#define CGAL_ARR_POINT_LOCATION_RESULT_H + +// The macro CGAL_POINT_LOCATION_VERSION controls which version of the +// point location is used. Currently two values are supported: +// 1. Point location with CGAL::Object +// 2. Point location with boost::optional > +// The default value is 2. + +#if !defined(CGAL_POINT_LOCATION_VERSION) +#define CGAL_POINT_LOCATION_VERSION 2 +#endif + +#include + +#include +#include + +namespace CGAL { + +template +struct Arr_point_location_result { + typedef Arrangement_ Arrangement_2; + + typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement_2::Face_const_handle Face_const_handle; + +#if CGAL_POINT_LOCATION_VERSION < 2 + typedef CGAL::Object Type; +#else + typedef typename boost::variant Variant_type; + typedef typename boost::optional Type; +#endif + typedef Type type; + + // This function returns either make_object() or a result_type constructor + // to generate return values. The Object version takes a dummy template + // argument, which is needed for the return of the other option, e.g., + // boost::optional >. + // In theory a one parameter variant could be returned, but this _could_ + // lead to conversion overhead, and so we rather go for the real type. + // Overloads for empty returns are also provided. +#if CGAL_POINT_LOCATION_VERSION < 2 + template + inline CGAL::Object operator()(T t) const { return CGAL::make_object(t); } + + inline CGAL::Object operator()() const { return CGAL::Object(); } +#else + template + inline Type operator()(T t) const { return Type(t); } + + inline Type operator()() const { return Type(); } +#endif // CGAL_POINT_LOCATION_VERSION < 2 +}; + +} //namespace CGAL + +#endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h index 7234078297a..d8938eeb4de 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h @@ -26,12 +26,8 @@ * Definition of the Arr_simple_point_location template. */ -#include +#include #include -#include - -#include -#include namespace CGAL { @@ -55,45 +51,26 @@ public: typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif + typedef Arr_point_location_result Result; + typedef typename Result::Type Result_type; + + // Support boost::result_of + typedef Result_type result_type; protected: typedef typename Topology_traits::Dcel Dcel; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 - // Data members: const Arrangement_2* p_arr; // The associated arrangement. const Traits_adaptor_2* geom_traits; // Its associated geometry traits. const Topology_traits* top_traits; // Its associated topology traits. -public: + template + Result_type result_return(T t) const { return Result()(t); } + inline Result_type result_return() const { return Result()(); } +public: /*! Default constructor. */ Arr_simple_point_location() : p_arr(NULL), @@ -145,9 +122,7 @@ public: * Halfedge_const_handle or a Vertex_const_handle. */ result_type ray_shoot_up(const Point_2& p) const - { - return (_vertical_ray_shoot(p, true)); - } + { return (_vertical_ray_shoot(p, true)); } /*! * Locate the arrangement feature which a downward vertical ray emanating @@ -158,12 +133,9 @@ public: * Halfedge_const_handle or a Vertex_const_handle. */ result_type ray_shoot_down(const Point_2& p) const - { - return (_vertical_ray_shoot(p, false)); - } + { return (_vertical_ray_shoot(p, false)); } protected: - /*! * Locate the arrangement feature which a vertical ray emanating from the * given point hits (not inculding isolated vertices). diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h index d1b9053fc68..6a5fe9eb9be 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h @@ -25,15 +25,11 @@ * Definition of the Arr_trapezoid_ric_point_location template. */ -#include +#include #include #include #include #include -#include - -#include -#include namespace CGAL { @@ -93,31 +89,31 @@ public: template class Arr_trapezoid_ric_point_location : public Arr_observer { public: - typedef Arrangement_ Arrangement_2; - typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; - typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2; + typedef Arrangement_ Arrangement_2; + typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2; + typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2; - typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; - typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; - typedef typename Arrangement_2::Face_const_handle Face_const_handle; - typedef typename Arrangement_2::Vertex_handle Vertex_handle; - typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; - typedef typename Arrangement_2::Face_handle Face_handle; - typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator; + typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; + typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; + typedef typename Arrangement_2::Face_const_handle Face_const_handle; + typedef typename Arrangement_2::Vertex_handle Vertex_handle; + typedef typename Arrangement_2::Halfedge_handle Halfedge_handle; + typedef typename Arrangement_2::Face_handle Face_handle; + typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator; - typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; - typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator; - typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator; - typedef typename Arrangement_2::Halfedge_const_iterator - Halfedge_const_iterator; + typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; + typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator; + typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator; + typedef typename Arrangement_2::Halfedge_const_iterator + Halfedge_const_iterator; typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator - Halfedge_around_vertex_const_circulator; + Halfedge_around_vertex_const_circulator; typedef typename Arrangement_2::Ccb_halfedge_const_circulator - Ccb_halfedge_const_circulator; + Ccb_halfedge_const_circulator; typedef typename Arrangement_2::Ccb_halfedge_circulator - Ccb_halfedge_circulator; + Ccb_halfedge_circulator; typedef typename Arrangement_2::Isolated_vertex_const_iterator - Isolated_vertex_const_iterator; + Isolated_vertex_const_iterator; typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; @@ -128,41 +124,21 @@ public: typedef PL_X_curve_plus X_curve_plus; typedef CGAL::Td_traits Td_traits; - typedef Trapezoidal_decomposition_2 Trapezoidal_decomposition; - typedef std::vector Halfedge_handle_container; - typedef typename Halfedge_handle_container::iterator - Halfedge_handle_iterator; + typedef Trapezoidal_decomposition_2 + Trapezoidal_decomposition; + typedef std::vector + Halfedge_handle_container; + typedef typename Halfedge_handle_container::iterator + Halfedge_handle_iterator; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif + typedef Arr_point_location_result Result; + typedef typename Result::Type Result_type; + + // Support boost::result_of + typedef Result_type result_type; protected: - typedef Trapezoidal_decomposition TD; - - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 + typedef Trapezoidal_decomposition TD; // Data members: const Traits_adaptor_2* m_traits; // Its associated traits object. @@ -174,8 +150,11 @@ protected: X_monotone_curve_2 m_curve_before_merge1; X_monotone_curve_2 m_curve_before_merge2; -public: + template + Result_type result_return(T t) const { return Result()(t); } + inline Result_type result_return() const { return Result()(); } +public: /*! Default constructor. */ Arr_trapezoid_ric_point_location(bool rebuild = true) : m_traits(NULL), @@ -322,14 +301,12 @@ public: //@} public: - #ifdef CGAL_TD_DEBUG void debug() { td.debug(); } #endif protected: - /*! Clear the trapezoidal decomposition. */ inline void clear_trapezoid_ric() { td.clear(); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h index 61533070797..efd3532cb05 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h @@ -26,11 +26,8 @@ * Definition of the Arr_walk_along_line_point_location template. */ +#include #include -#include - -#include -#include namespace CGAL { @@ -57,48 +54,30 @@ public: typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif + typedef Arr_point_location_result Result; + typedef typename Result::Type Result_type; + + // Support boost::result_of + typedef Result_type result_type; protected: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; typedef typename Arrangement_2::Ccb_halfedge_const_circulator - Ccb_halfedge_const_circulator; + Ccb_halfedge_const_circulator; typedef typename Arrangement_2::Inner_ccb_const_iterator - Inner_ccb_const_iterator; + Inner_ccb_const_iterator; typedef typename Arrangement_2::Isolated_vertex_const_iterator - Isolated_vertex_const_iterator; - - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 + Isolated_vertex_const_iterator; // Data members: const Arrangement_2* p_arr; // The associated arrangement. const Traits_adaptor_2* geom_traits; // Its associated geometry traits. const Topology_traits* top_traits; // Its associated topology traits. + template + Result_type result_return(T t) const { return Result()(t); } + inline Result_type result_return() const { return Result()(); } + public: /*! Default constructor. */ Arr_walk_along_line_point_location() : diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h index 2f84acc337c..e91837ef37b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h @@ -25,7 +25,7 @@ * Definition of the Arr_batched_pl_sl_visitor class-template. */ -#include +#include #include #include @@ -52,42 +52,21 @@ public: typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; typedef typename Arrangement_2::Face_const_handle Face_const_handle; -#if CGAL_POINT_LOCATION_VERSION < 2 - typedef CGAL::Object result_type; -#else - typedef typename boost::variant variant_type; - typedef typename boost::optional result_type; -#endif - protected: typedef typename Helper::Base_visitor Base; typedef typename Base::Status_line_iterator Status_line_iterator; - - // This function returns either make_object() or a result_type constructor - // to generate return values. The Object version takes a dummy template - // argument, which is needed for the return of the other option, e.g., - // boost::optional >. - // In theory a one parameter variant could be returned, but this _could_ - // lead to conversion overhead, and so we rather go for the real type. - // Overloads for empty returns are also provided. -#if CGAL_POINT_LOCATION_VERSION < 2 - template - inline CGAL::Object result_return(T t) const { return CGAL::make_object(t); } - - inline CGAL::Object result_return() const { return CGAL::Object(); } -#else - template - inline result_type result_return(T t) const { return result_type(t); } - - inline result_type result_return() const { return result_type(); } -#endif // CGAL_POINT_LOCATION_VERSION < 2 + typedef Arr_point_location_result Pl_result; + typedef typename Pl_result::Type Pl_result_type; + // Data members: Helper m_helper; // The helper class. OutputIterator& m_out; // An output iterator for the result. + template + Pl_result_type pl_result_return(T t) { return Pl_result()(t); } + inline Pl_result_type pl_result_return() { return Pl_result()(); } + public: /*! * Constructor. @@ -148,7 +127,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above) if (event->is_action()) { // The query point coincides with an isolated arrangement vertex: Vertex_const_handle vh = event->point().vertex_handle(); - *m_out++ = std::make_pair(event->point().base(), result_return(vh)); + *m_out++ = std::make_pair(event->point().base(), pl_result_return(vh)); return true; } @@ -171,15 +150,15 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above) vh = he->source(); } - *m_out++ = std::make_pair(event->point().base(), result_return(vh)); + *m_out++ = std::make_pair(event->point().base(), pl_result_return(vh)); return true; } if (above == this->status_line_end()) { // There are no valid edges above the query point, so we use the helper // class to obtain the current top face. - *m_out++ = - std::make_pair(event->point().base(), result_return(m_helper.top_face())); + *m_out++ = std::make_pair(event->point().base(), + pl_result_return(m_helper.top_face())); return true; } @@ -187,7 +166,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above) // The query point lies on the halfedge associated with the subcurve // that the status-line iterator refers to. Halfedge_const_handle he = (*above)->last_curve().halfedge_handle(); - *m_out++ = std::make_pair(event->point().base(), result_return(he)); + *m_out++ = std::make_pair(event->point().base(), pl_result_return(he)); return true; } @@ -195,7 +174,7 @@ after_handle_event(Event* event, Status_line_iterator above, bool on_above) // the query point, such that the query point is located in the incident // face of this halfedge. Halfedge_const_handle he = (*above)->last_curve().halfedge_handle(); - *m_out++ = std::make_pair(event->point().base(), result_return(he->face())); + *m_out++ = std::make_pair(event->point().base(), pl_result_return(he->face())); return true; }