summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/calculate_sum.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/calculate_sum.hpp')
-rw-r--r--boost/geometry/algorithms/detail/calculate_sum.hpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/boost/geometry/algorithms/detail/calculate_sum.hpp b/boost/geometry/algorithms/detail/calculate_sum.hpp
index 2ad349080b..b23e70171b 100644
--- a/boost/geometry/algorithms/detail/calculate_sum.hpp
+++ b/boost/geometry/algorithms/detail/calculate_sum.hpp
@@ -3,6 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -14,9 +15,7 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CALCULATE_SUM_HPP
-
#include <boost/range.hpp>
-#include <boost/typeof/typeof.hpp>
namespace boost { namespace geometry
{
@@ -26,20 +25,14 @@ namespace detail
{
-template
-<
- typename ReturnType,
- typename Polygon,
- typename Strategy,
- typename Policy
->
class calculate_polygon_sum
{
- template <typename Rings>
+ template <typename ReturnType, typename Policy, typename Rings, typename Strategy>
static inline ReturnType sum_interior_rings(Rings const& rings, Strategy const& strategy)
{
ReturnType sum = ReturnType();
- for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
+ for (typename boost::range_iterator<Rings const>::type
+ it = boost::begin(rings); it != boost::end(rings); ++it)
{
sum += Policy::apply(*it, strategy);
}
@@ -47,10 +40,11 @@ class calculate_polygon_sum
}
public :
+ template <typename ReturnType, typename Policy, typename Polygon, typename Strategy>
static inline ReturnType apply(Polygon const& poly, Strategy const& strategy)
{
return Policy::apply(exterior_ring(poly), strategy)
- + sum_interior_rings(interior_rings(poly), strategy)
+ + sum_interior_rings<ReturnType, Policy>(interior_rings(poly), strategy)
;
}
};