reverse_dispatch.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
  11. #define BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
  12. #include <cstddef>
  13. #include <boost/mpl/if.hpp>
  14. #include <boost/type_traits/integral_constant.hpp>
  15. #include <boost/geometry/core/geometry_id.hpp>
  16. namespace boost { namespace geometry
  17. {
  18. #ifndef DOXYGEN_NO_DETAIL
  19. namespace detail
  20. {
  21. // Different geometries: reverse_dispatch if second ID < first ID
  22. template <std::size_t GeometryId1, std::size_t GeometryId2>
  23. struct reverse_dispatch : boost::mpl::if_c
  24. <
  25. (GeometryId1 > GeometryId2),
  26. boost::true_type,
  27. boost::false_type
  28. >
  29. {};
  30. // Same geometry: never reverse_dispatch
  31. template <std::size_t GeometryId>
  32. struct reverse_dispatch<GeometryId, GeometryId> : boost::false_type {};
  33. } // namespace detail
  34. #endif // DOXYGEN_NO_DETAIL
  35. template <typename Geometry1, typename Geometry2>
  36. struct reverse_dispatch : detail::reverse_dispatch
  37. <
  38. geometry_id<Geometry1>::type::value,
  39. geometry_id<Geometry2>::type::value
  40. >
  41. {};
  42. }} // namespace boost::geometry
  43. #endif // BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP