|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80917 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-10-09 18:22:18
Author: bruno.lalande
Date: 2012-10-09 18:22:17 EDT (Tue, 09 Oct 2012)
New Revision: 80917
URL: http://svn.boost.org/trac/boost/changeset/80917
Log:
Removed IsConst stuff from dispatch::for_each - this is useless because constness is part of the type already.
Text files modified:
trunk/boost/geometry/algorithms/for_each.hpp | 100 +++++++++++++++++----------------------
1 files changed, 43 insertions(+), 57 deletions(-)
Modified: trunk/boost/geometry/algorithms/for_each.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/for_each.hpp (original)
+++ trunk/boost/geometry/algorithms/for_each.hpp 2012-10-09 18:22:17 EDT (Tue, 09 Oct 2012)
@@ -40,11 +40,10 @@
{
-template <typename Point, typename Functor, bool IsConst>
+template <typename Point, typename Functor>
struct fe_point_per_point
{
- static inline Functor apply(
- typename add_const_if_c<IsConst, Point>::type& point, Functor f)
+ static inline Functor apply(Point& point, Functor f)
{
f(point);
return f;
@@ -52,11 +51,10 @@
};
-template <typename Point, typename Functor, bool IsConst>
+template <typename Point, typename Functor>
struct fe_point_per_segment
{
- static inline Functor apply(
- typename add_const_if_c<IsConst, Point>::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 @@
};
-template <typename Range, typename Functor, bool IsConst>
+template <typename Range, typename Functor>
struct fe_range_per_point
{
- static inline Functor apply(
- typename add_const_if_c<IsConst, Range>::type& range,
- Functor f)
+ static inline Functor apply(Range& range, Functor f)
{
return (std::for_each(boost::begin(range), boost::end(range), f));
}
};
-template <typename Range, typename Functor, bool IsConst>
+template <typename Range, typename Functor>
struct fe_range_per_segment
{
- static inline Functor apply(
- typename add_const_if_c<IsConst, Range>::type& range,
- Functor f)
+ static inline Functor apply(Range& range, Functor f)
{
typedef typename add_const_if_c
<
- IsConst,
+ is_const<Range>::value,
typename point_type<Range>::type
>::type point_type;
@@ -104,23 +98,20 @@
};
-template <typename Polygon, typename Functor, bool IsConst>
+template <typename Polygon, typename Functor>
struct fe_polygon_per_point
{
- typedef typename add_const_if_c<IsConst, Polygon>::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<Polygon>::type,
- Functor,
- IsConst
+ Functor
> per_ring;
f = per_ring::apply(exterior_ring(poly), f);
- typename interior_return_type<poly_type>::type rings
+ typename interior_return_type<Polygon>::type rings
= interior_rings(poly);
for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
{
@@ -133,23 +124,20 @@
};
-template <typename Polygon, typename Functor, bool IsConst>
+template <typename Polygon, typename Functor>
struct fe_polygon_per_segment
{
- typedef typename add_const_if_c<IsConst, Polygon>::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<Polygon>::type,
- Functor,
- IsConst
+ Functor
> per_ring;
f = per_ring::apply(exterior_ring(poly), f);
- typename interior_return_type<poly_type>::type rings
+ typename interior_return_type<Polygon>::type rings
= interior_rings(poly);
for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
{
@@ -174,33 +162,32 @@
<
typename Tag,
typename Geometry,
- typename Functor,
- bool IsConst = is_const<Geometry>::value
+ typename Functor
>
struct for_each_point {};
-template <typename Point, typename Functor, bool IsConst>
-struct for_each_point<point_tag, Point, Functor, IsConst>
- : detail::for_each::fe_point_per_point<Point, Functor, IsConst>
+template <typename Point, typename Functor>
+struct for_each_point<point_tag, Point, Functor>
+ : detail::for_each::fe_point_per_point<Point, Functor>
{};
-template <typename Linestring, typename Functor, bool IsConst>
-struct for_each_point<linestring_tag, Linestring, Functor, IsConst>
- : detail::for_each::fe_range_per_point<Linestring, Functor, IsConst>
+template <typename Linestring, typename Functor>
+struct for_each_point<linestring_tag, Linestring, Functor>
+ : detail::for_each::fe_range_per_point<Linestring, Functor>
{};
-template <typename Ring, typename Functor, bool IsConst>
-struct for_each_point<ring_tag, Ring, Functor, IsConst>
- : detail::for_each::fe_range_per_point<Ring, Functor, IsConst>
+template <typename Ring, typename Functor>
+struct for_each_point<ring_tag, Ring, Functor>
+ : detail::for_each::fe_range_per_point<Ring, Functor>
{};
-template <typename Polygon, typename Functor, bool IsConst>
-struct for_each_point<polygon_tag, Polygon, Functor, IsConst>
- : detail::for_each::fe_polygon_per_point<Polygon, Functor, IsConst>
+template <typename Polygon, typename Functor>
+struct for_each_point<polygon_tag, Polygon, Functor>
+ : detail::for_each::fe_polygon_per_point<Polygon, Functor>
{};
@@ -208,32 +195,31 @@
<
typename Tag,
typename Geometry,
- typename Functor,
- bool IsConst = is_const<Geometry>::value
+ typename Functor
>
struct for_each_segment {};
-template <typename Point, typename Functor, bool IsConst>
-struct for_each_segment<point_tag, Point, Functor, IsConst>
- : detail::for_each::fe_point_per_segment<Point, Functor, IsConst>
+template <typename Point, typename Functor>
+struct for_each_segment<point_tag, Point, Functor>
+ : detail::for_each::fe_point_per_segment<Point, Functor>
{};
-template <typename Linestring, typename Functor, bool IsConst>
-struct for_each_segment<linestring_tag, Linestring, Functor, IsConst>
- : detail::for_each::fe_range_per_segment<Linestring, Functor, IsConst>
+template <typename Linestring, typename Functor>
+struct for_each_segment<linestring_tag, Linestring, Functor>
+ : detail::for_each::fe_range_per_segment<Linestring, Functor>
{};
-template <typename Ring, typename Functor, bool IsConst>
-struct for_each_segment<ring_tag, Ring, Functor, IsConst>
- : detail::for_each::fe_range_per_segment<Ring, Functor, IsConst>
+template <typename Ring, typename Functor>
+struct for_each_segment<ring_tag, Ring, Functor>
+ : detail::for_each::fe_range_per_segment<Ring, Functor>
{};
-template <typename Polygon, typename Functor, bool IsConst>
-struct for_each_segment<polygon_tag, Polygon, Functor, IsConst>
- : detail::for_each::fe_polygon_per_segment<Polygon, Functor, IsConst>
+template <typename Polygon, typename Functor>
+struct for_each_segment<polygon_tag, Polygon, Functor>
+ : detail::for_each::fe_polygon_per_segment<Polygon, Functor>
{};
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk