1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2014.
6 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
17 #include <boost/geometry/core/coordinate_dimension.hpp>
18 #include <boost/geometry/core/coordinate_type.hpp>
19 #include <boost/geometry/util/math.hpp>
21 namespace boost { namespace geometry
24 #ifndef DOXYGEN_NO_DISPATCH
25 namespace detail_dispatch { namespace relate {
27 // TODO: Integrate it with geometry::less?
29 template <typename Point1,
32 std::size_t D = geometry::dimension<Point1>::value>
35 static inline bool apply(Point1 const& left, Point2 const& right)
37 typename geometry::coordinate_type<Point1>::type
38 cleft = geometry::get<I>(left);
39 typename geometry::coordinate_type<Point2>::type
40 cright = geometry::get<I>(right);
42 if ( geometry::math::equals(cleft, cright) )
44 return less<Point1, Point2, I + 1, D>::apply(left, right);
48 return cleft < cright;
53 template <typename Point1, typename Point2, std::size_t D>
54 struct less<Point1, Point2, D, D>
56 static inline bool apply(Point1 const&, Point2 const&)
62 }} // namespace detail_dispatch::relate
66 #ifndef DOXYGEN_NO_DETAIL
67 namespace detail { namespace relate {
71 template <typename Point1, typename Point2>
72 inline bool operator()(Point1 const& point1, Point2 const& point2) const
74 return detail_dispatch::relate::less<Point1, Point2>::apply(point1, point2);
78 }} // namespace detail::relate
79 #endif // DOXYGEN_NO_DETAIL
81 }} // namespace boost::geometry
83 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP