File indexing completed on 2025-01-18 09:35:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_GEOMETRY_CORE_COORDINATE_PROMOTION_HPP
0010 #define BOOST_GEOMETRY_CORE_COORDINATE_PROMOTION_HPP
0011
0012 #include <boost/geometry/core/coordinate_type.hpp>
0013
0014
0015 #include <boost/rational.hpp>
0016 #include <boost/multiprecision/cpp_bin_float.hpp>
0017 #include <boost/multiprecision/cpp_int.hpp>
0018
0019 namespace boost { namespace geometry
0020 {
0021
0022 namespace traits
0023 {
0024
0025
0026
0027 }
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <typename T, typename PromoteIntegerTo = double>
0038 struct promote_floating_point
0039 {
0040 typedef std::conditional_t
0041 <
0042 std::is_integral<T>::value,
0043 PromoteIntegerTo,
0044 T
0045 > type;
0046 };
0047
0048
0049 template <typename Geometry>
0050 struct fp_coordinate_type
0051 {
0052 typedef typename promote_floating_point
0053 <
0054 typename coordinate_type<Geometry>::type
0055 >::type type;
0056 };
0057
0058 namespace detail
0059 {
0060
0061
0062
0063
0064
0065 template <typename Type>
0066 struct promoted_to_floating_point
0067 {
0068 using type = std::conditional_t
0069 <
0070 std::is_integral<Type>::value, double, Type
0071 >;
0072 };
0073
0074
0075 template <typename T>
0076 struct promoted_to_floating_point<boost::rational<T>>
0077 {
0078 using type = double;
0079 };
0080
0081
0082
0083 template <typename Backend>
0084 struct promoted_to_floating_point<boost::multiprecision::number<Backend>>
0085 {
0086 using type = double;
0087 };
0088
0089
0090 template <unsigned Digits>
0091 struct promoted_to_floating_point
0092 <
0093 boost::multiprecision::number
0094 <
0095 boost::multiprecision::cpp_bin_float<Digits>
0096 >
0097 >
0098 {
0099 using type = boost::multiprecision::number
0100 <
0101 boost::multiprecision::cpp_bin_float<Digits>
0102 >;
0103 };
0104
0105 }
0106
0107
0108 }}
0109
0110
0111 #endif