1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6 
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9 
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 
14 
15 #ifndef BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
16 #define BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
17 
18 
19 #include <cstddef>
20 
21 #include <boost/type_traits.hpp>
22 #include <boost/mpl/if.hpp>
23 #include <boost/mpl/greater.hpp>
24 
25 #include <boost/geometry/core/geometry_id.hpp>
26 
27 
28 namespace boost { namespace geometry
29 {
30 
31 
32 #ifndef DOXYGEN_NO_DETAIL
33 namespace detail
34 {
35 
36 // Different geometries: reverse_dispatch if second ID < first ID
37 template <std::size_t GeometryId1, std::size_t GeometryId2>
38 struct reverse_dispatch : boost::mpl::if_c
39     <
40         (GeometryId1 > GeometryId2),
41         boost::true_type,
42         boost::false_type
43     >
44 {};
45 
46 
47 // Same geometry: never reverse_dispatch
48 template <std::size_t GeometryId>
49 struct reverse_dispatch<GeometryId, GeometryId> : boost::false_type {};
50 
51 
52 } // namespace detail
53 #endif // DOXYGEN_NO_DETAIL
54 
55 
56 template <typename Geometry1, typename Geometry2>
57 struct reverse_dispatch : detail::reverse_dispatch
58     <
59         geometry_id<Geometry1>::type::value,
60         geometry_id<Geometry2>::type::value
61     >
62 {};
63 
64 
65 }} // namespace boost::geometry
66 
67 #endif // BOOST_GEOMETRY_CORE_REVERSE_DISPATCH_HPP
68