]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/area_result.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / geometry / strategies / area_result.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP
10 #define BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP
11
12
13 #include <boost/geometry/core/coordinate_type.hpp>
14 #include <boost/geometry/core/cs.hpp>
15
16 #include <boost/geometry/strategies/area.hpp>
17 #include <boost/geometry/strategies/default_strategy.hpp>
18
19 #include <boost/geometry/util/select_most_precise.hpp>
20 #include <boost/geometry/util/select_sequence_element.hpp>
21
22
23 #include <boost/mpl/if.hpp>
24 #include <boost/type_traits/is_same.hpp>
25 #include <boost/variant/variant_fwd.hpp>
26
27
28 namespace boost { namespace geometry
29 {
30
31
32 /*!
33 \brief Meta-function defining return type of area function
34 \ingroup area
35 \note The return-type is defined by Geometry and Strategy
36 */
37 template
38 <
39 typename Geometry,
40 typename Strategy = default_strategy
41 >
42 struct area_result
43 : Strategy::template result_type<Geometry>
44 {};
45
46 template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename Strategy>
47 struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Strategy>
48 : geometry::area_result
49 <
50 typename geometry::util::select_sequence_element
51 <
52 typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types
53 >::type,
54 Strategy
55 >
56 {};
57
58 template <typename Geometry>
59 struct area_result<Geometry, default_strategy>
60 : geometry::area_result
61 <
62 Geometry,
63 typename geometry::strategy::area::services::default_strategy
64 <
65 typename cs_tag<Geometry>::type
66 >::type
67 >
68 {};
69
70 #ifndef DOXYGEN_NO_DETAIL
71 namespace detail { namespace area
72 {
73
74 template <typename Curr, typename Next>
75 struct pred_more_precise_default_area_result
76 {
77 typedef typename geometry::area_result<Curr, default_strategy>::type curr_result_t;
78 typedef typename geometry::area_result<Next, default_strategy>::type next_result_t;
79
80 typedef typename boost::mpl::if_c
81 <
82 boost::is_same
83 <
84 curr_result_t,
85 typename geometry::select_most_precise
86 <
87 curr_result_t,
88 next_result_t
89 >::type
90 >::value,
91 Curr,
92 Next
93 >::type type;
94 };
95
96 }} // namespace detail::area
97 #endif //DOXYGEN_NO_DETAIL
98
99 template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
100 struct area_result<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, default_strategy>
101 : geometry::area_result
102 <
103 typename geometry::util::select_sequence_element
104 <
105 typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types,
106 geometry::detail::area::pred_more_precise_default_area_result
107 >::type,
108 default_strategy
109 >
110 {};
111
112
113 }} // namespace boost::geometry
114
115
116 #endif // BOOST_GEOMETRY_STRATEGIES_AREA_RESULT_HPP