Chris@102
|
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
|
Chris@102
|
2
|
Chris@102
|
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
|
Chris@102
|
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
|
Chris@102
|
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
|
Chris@102
|
6
|
Chris@102
|
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
|
Chris@102
|
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
|
Chris@102
|
9
|
Chris@102
|
10 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@102
|
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
12 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
13
|
Chris@102
|
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP
|
Chris@102
|
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP
|
Chris@102
|
16
|
Chris@102
|
17 #include <boost/range.hpp>
|
Chris@102
|
18
|
Chris@102
|
19
|
Chris@102
|
20 namespace boost { namespace geometry
|
Chris@102
|
21 {
|
Chris@102
|
22 #ifndef DOXYGEN_NO_DETAIL
|
Chris@102
|
23 namespace detail
|
Chris@102
|
24 {
|
Chris@102
|
25
|
Chris@102
|
26 struct multi_sum
|
Chris@102
|
27 {
|
Chris@102
|
28 template <typename ReturnType, typename Policy, typename MultiGeometry, typename Strategy>
|
Chris@102
|
29 static inline ReturnType apply(MultiGeometry const& geometry, Strategy const& strategy)
|
Chris@102
|
30 {
|
Chris@102
|
31 ReturnType sum = ReturnType();
|
Chris@102
|
32 for (typename boost::range_iterator
|
Chris@102
|
33 <
|
Chris@102
|
34 MultiGeometry const
|
Chris@102
|
35 >::type it = boost::begin(geometry);
|
Chris@102
|
36 it != boost::end(geometry);
|
Chris@102
|
37 ++it)
|
Chris@102
|
38 {
|
Chris@102
|
39 sum += Policy::apply(*it, strategy);
|
Chris@102
|
40 }
|
Chris@102
|
41 return sum;
|
Chris@102
|
42 }
|
Chris@102
|
43 };
|
Chris@102
|
44
|
Chris@102
|
45
|
Chris@102
|
46 } // namespace detail
|
Chris@102
|
47 #endif
|
Chris@102
|
48
|
Chris@102
|
49 }} // namespace boost::geometry
|
Chris@102
|
50
|
Chris@102
|
51
|
Chris@102
|
52 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_MULTI_SUM_HPP
|