reverse_dispatch.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2020.
  6. // Modifications copyright (c) 2020, Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
  14. #define BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
  15. #include <cstddef>
  16. #include <type_traits>
  17. #include <boost/geometry/core/geometry_id.hpp>
  18. namespace boost { namespace geometry
  19. {
  20. #ifndef DOXYGEN_NO_DETAIL
  21. namespace detail
  22. {
  23. // Different geometries: reverse_dispatch if second ID < first ID
  24. template <std::size_t GeometryId1, std::size_t GeometryId2>
  25. struct reverse_dispatch
  26. : std::integral_constant
  27. <
  28. bool,
  29. (GeometryId1 > GeometryId2)
  30. >
  31. {};
  32. // Same geometry: never reverse_dispatch
  33. template <std::size_t GeometryId>
  34. struct reverse_dispatch<GeometryId, GeometryId> : std::false_type {};
  35. } // namespace detail
  36. #endif // DOXYGEN_NO_DETAIL
  37. template <typename Geometry1, typename Geometry2>
  38. struct reverse_dispatch : detail::reverse_dispatch
  39. <
  40. geometry_id<Geometry1>::type::value,
  41. geometry_id<Geometry2>::type::value
  42. >
  43. {};
  44. }} // namespace boost::geometry
  45. #endif // BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP