From ce600855ba3a02538661e155e12be90d9dc2209a Mon Sep 17 00:00:00 2001 From: Bruno Lalande Date: Tue, 9 Oct 2012 22:22:17 +0000 Subject: [PATCH] Removed IsConst stuff from dispatch::for_each - this is useless because constness is part of the type already. [SVN r80917] --- .../boost/geometry/algorithms/for_each.hpp | 100 ++++++++---------- 1 file changed, 43 insertions(+), 57 deletions(-) diff --git a/include/boost/geometry/algorithms/for_each.hpp b/include/boost/geometry/algorithms/for_each.hpp index 1d52d63bd..14f5cdf54 100644 --- a/include/boost/geometry/algorithms/for_each.hpp +++ b/include/boost/geometry/algorithms/for_each.hpp @@ -40,11 +40,10 @@ namespace detail { namespace for_each { -template +template struct fe_point_per_point { - static inline Functor apply( - typename add_const_if_c::type& point, Functor f) + static inline Functor apply(Point& point, Functor f) { f(point); return f; @@ -52,11 +51,10 @@ struct fe_point_per_point }; -template +template struct fe_point_per_segment { - static inline Functor apply( - typename add_const_if_c::type& , Functor f) + static inline Functor apply(Point& , Functor f) { // TODO: if non-const, we should extract the points from the segment // and call the functor on those two points @@ -65,28 +63,24 @@ struct fe_point_per_segment }; -template +template struct fe_range_per_point { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + static inline Functor apply(Range& range, Functor f) { return (std::for_each(boost::begin(range), boost::end(range), f)); } }; -template +template struct fe_range_per_segment { - static inline Functor apply( - typename add_const_if_c::type& range, - Functor f) + static inline Functor apply(Range& range, Functor f) { typedef typename add_const_if_c < - IsConst, + is_const::value, typename point_type::type >::type point_type; @@ -104,23 +98,20 @@ struct fe_range_per_segment }; -template +template struct fe_polygon_per_point { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + static inline Functor apply(Polygon& poly, Functor f) { typedef fe_range_per_point < typename ring_type::type, - Functor, - IsConst + Functor > per_ring; f = per_ring::apply(exterior_ring(poly), f); - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { @@ -133,23 +124,20 @@ struct fe_polygon_per_point }; -template +template struct fe_polygon_per_segment { - typedef typename add_const_if_c::type poly_type; - - static inline Functor apply(poly_type& poly, Functor f) + static inline Functor apply(Polygon& poly, Functor f) { typedef fe_range_per_segment < typename ring_type::type, - Functor, - IsConst + Functor > per_ring; f = per_ring::apply(exterior_ring(poly), f); - typename interior_return_type::type rings + typename interior_return_type::type rings = interior_rings(poly); for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it) { @@ -174,33 +162,32 @@ template < typename Tag, typename Geometry, - typename Functor, - bool IsConst = is_const::value + typename Functor > struct for_each_point {}; -template -struct for_each_point - : detail::for_each::fe_point_per_point +template +struct for_each_point + : detail::for_each::fe_point_per_point {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point {}; -template -struct for_each_point - : detail::for_each::fe_range_per_point +template +struct for_each_point + : detail::for_each::fe_range_per_point {}; -template -struct for_each_point - : detail::for_each::fe_polygon_per_point +template +struct for_each_point + : detail::for_each::fe_polygon_per_point {}; @@ -208,32 +195,31 @@ template < typename Tag, typename Geometry, - typename Functor, - bool IsConst = is_const::value + typename Functor > struct for_each_segment {}; -template -struct for_each_segment - : detail::for_each::fe_point_per_segment +template +struct for_each_segment + : detail::for_each::fe_point_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_range_per_segment +template +struct for_each_segment + : detail::for_each::fe_range_per_segment {}; -template -struct for_each_segment - : detail::for_each::fe_polygon_per_segment +template +struct for_each_segment + : detail::for_each::fe_polygon_per_segment {};