]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/area_result.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / area_result.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
4
5 // This file was modified by Oracle on 2020-2021.
6 // Modifications copyright (c) 2020-2021 Oracle and/or its affiliates.
7 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8
9 // Use, modification and distribution is subject to the Boost Software License,
10 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12
13 #ifndef BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
14 #define BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP
15
16
17 #include <type_traits>
18
19 #include <boost/geometry/algorithms/detail/select_geometry_type.hpp>
20
21 #include <boost/geometry/core/coordinate_type.hpp>
22 #include <boost/geometry/core/cs.hpp>
23 #include <boost/geometry/core/geometry_types.hpp>
24 #include <boost/geometry/core/tag.hpp>
25 #include <boost/geometry/core/tags.hpp>
26
27 #include <boost/geometry/strategies/area/services.hpp>
28 #include <boost/geometry/strategies/default_strategy.hpp>
29 #include <boost/geometry/strategies/detail.hpp>
30
31 #include <boost/geometry/util/select_most_precise.hpp>
32 #include <boost/geometry/util/sequence.hpp>
33 #include <boost/geometry/util/type_traits.hpp>
34
35 namespace boost { namespace geometry
36 {
37
38
39 #ifndef DOXYGEN_NO_DETAIL
40 namespace detail { namespace area
41 {
42
43
44 template
45 <
46 typename Geometry,
47 typename Strategy,
48 bool IsUmbrella = strategies::detail::is_umbrella_strategy<Strategy>::value
49 >
50 struct area_result
51 {
52 typedef decltype(std::declval<Strategy>().area(std::declval<Geometry>())) strategy_type;
53 typedef typename strategy_type::template result_type<Geometry>::type type;
54 };
55
56 template <typename Geometry, typename Strategy>
57 struct area_result<Geometry, Strategy, false>
58 {
59 typedef typename Strategy::template result_type<Geometry>::type type;
60 };
61
62
63 template <typename Geometry>
64 struct default_area_result
65 : area_result
66 <
67 Geometry,
68 typename geometry::strategies::area::services::default_strategy
69 <
70 Geometry
71 >::type
72 >
73 {};
74
75
76 template <typename Curr, typename Next>
77 struct more_precise_coordinate_type
78 : std::is_same
79 <
80 typename geometry::coordinate_type<Curr>::type,
81 typename geometry::select_most_precise
82 <
83 typename geometry::coordinate_type<Curr>::type,
84 typename geometry::coordinate_type<Next>::type
85 >::type
86 >
87 {};
88
89
90 template <typename Curr, typename Next>
91 struct more_precise_default_area_result
92 : std::is_same
93 <
94 typename default_area_result<Curr>::type,
95 typename geometry::select_most_precise
96 <
97 typename default_area_result<Curr>::type,
98 typename default_area_result<Next>::type
99 >::type
100 >
101 {};
102
103
104 }} // namespace detail::area
105 #endif //DOXYGEN_NO_DETAIL
106
107
108 /*!
109 \brief Meta-function defining return type of area function
110 \ingroup area
111 \note The return-type is defined by Geometry and Strategy
112 */
113 template
114 <
115 typename Geometry,
116 typename Strategy = default_strategy
117 >
118 struct area_result
119 : detail::area::area_result
120 <
121 typename detail::select_geometry_type
122 <
123 Geometry,
124 detail::area::more_precise_coordinate_type
125 >::type,
126 Strategy
127 >
128 {};
129
130 template <typename Geometry>
131 struct area_result<Geometry, default_strategy>
132 : detail::area::default_area_result
133 <
134 typename detail::select_geometry_type
135 <
136 Geometry,
137 detail::area::more_precise_default_area_result
138 >::type
139 >
140 {};
141
142
143 }} // namespace boost::geometry
144
145
146 #endif // BOOST_GEOMETRY_ALGORITHMS_AREA_RESULT_HPP