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