robust_type.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2014 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2014 Mateusz Loskot, London, UK.
  5. // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #ifndef BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP
  10. #define BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP
  11. #include <boost/config.hpp>
  12. #include <boost/type_traits/is_floating_point.hpp>
  13. namespace boost { namespace geometry
  14. {
  15. #ifndef DOXYGEN_NO_DETAIL
  16. namespace detail_dispatch
  17. {
  18. template <typename CoordinateType, typename IsFloatingPoint>
  19. struct robust_type
  20. {
  21. };
  22. template <typename CoordinateType>
  23. struct robust_type<CoordinateType, boost::false_type>
  24. {
  25. typedef CoordinateType type;
  26. };
  27. template <typename CoordinateType>
  28. struct robust_type<CoordinateType, boost::true_type>
  29. {
  30. typedef boost::long_long_type type;
  31. };
  32. } // namespace detail_dispatch
  33. namespace detail
  34. {
  35. template <typename CoordinateType>
  36. struct robust_type
  37. {
  38. typedef typename detail_dispatch::robust_type
  39. <
  40. CoordinateType,
  41. typename boost::is_floating_point<CoordinateType>::type
  42. >::type type;
  43. };
  44. } // namespace detail
  45. #endif // DOXYGEN_NO_DETAIL
  46. }} // namespace boost::geometry
  47. #endif // BOOST_GEOMETRY_POLICIES_ROBUSTNESS_ROBUST_TYPE_HPP