123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #ifndef BOOST_GEOMETRY_CORE_COORDINATE_PROMOTION_HPP
- #define BOOST_GEOMETRY_CORE_COORDINATE_PROMOTION_HPP
- #include <boost/geometry/core/coordinate_type.hpp>
- #include <boost/rational.hpp>
- #include <boost/multiprecision/cpp_bin_float.hpp>
- #include <boost/multiprecision/cpp_int.hpp>
- namespace boost { namespace geometry
- {
- namespace traits
- {
- }
- template <typename T, typename PromoteIntegerTo = double>
- struct promote_floating_point
- {
- typedef std::conditional_t
- <
- std::is_integral<T>::value,
- PromoteIntegerTo,
- T
- > type;
- };
- template <typename Geometry>
- struct fp_coordinate_type
- {
- typedef typename promote_floating_point
- <
- typename coordinate_type<Geometry>::type
- >::type type;
- };
- namespace detail
- {
- template <typename Type>
- struct promoted_to_floating_point
- {
- using type = std::conditional_t
- <
- std::is_integral<Type>::value, double, Type
- >;
- };
- template <typename T>
- struct promoted_to_floating_point<boost::rational<T>>
- {
- using type = double;
- };
- template <typename Backend>
- struct promoted_to_floating_point<boost::multiprecision::number<Backend>>
- {
- using type = double;
- };
- template <unsigned Digits>
- struct promoted_to_floating_point
- <
- boost::multiprecision::number
- <
- boost::multiprecision::cpp_bin_float<Digits>
- >
- >
- {
- using type = boost::multiprecision::number
- <
- boost::multiprecision::cpp_bin_float<Digits>
- >;
- };
- }
- }}
- #endif
|