strategy_utils.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Boost.Geometry
  2. // Copyright (c) 2021, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_ALGORITHS_DETAIL_DISTANCE_STRATEGY_UTILS_HPP
  7. #define BOOST_GEOMETRY_ALGORITHS_DETAIL_DISTANCE_STRATEGY_UTILS_HPP
  8. #include <utility>
  9. #include <boost/geometry/core/point_type.hpp>
  10. #include <boost/geometry/strategies/distance.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. #ifndef DOXYGEN_NO_DETAIL
  14. namespace detail { namespace distance
  15. {
  16. template <typename Geometry1, typename Geometry2, typename Strategies>
  17. using strategy_t = decltype(
  18. std::declval<Strategies>().distance(std::declval<Geometry1>(), std::declval<Geometry2>()));
  19. template <typename Geometry1, typename Geometry2, typename Strategies>
  20. using return_t = typename strategy::distance::services::return_type
  21. <
  22. strategy_t<Geometry1, Geometry2, Strategies>,
  23. typename point_type<Geometry1>::type,
  24. typename point_type<Geometry2>::type
  25. >::type;
  26. template <typename Geometry1, typename Geometry2, typename Strategies>
  27. using cstrategy_t = typename strategy::distance::services::comparable_type
  28. <
  29. strategy_t<Geometry1, Geometry2, Strategies>
  30. >::type;
  31. template <typename Geometry1, typename Geometry2, typename Strategies>
  32. using creturn_t = typename strategy::distance::services::return_type
  33. <
  34. cstrategy_t<Geometry1, Geometry2, Strategies>,
  35. typename point_type<Geometry1>::type,
  36. typename point_type<Geometry2>::type
  37. >::type;
  38. }} // namespace detail::distance
  39. #endif // DOXYGEN_NO_DETAIL
  40. }} // namespace boost::geometry
  41. #endif // BOOST_GEOMETRY_ALGORITHS_DETAIL_DISTANCE_STRATEGY_UTILS_HPP