]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/relate/less.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / relate / less.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands.
4
5// This file was modified by Oracle on 2014.
6// Modifications copyright (c) 2014, Oracle and/or its affiliates.
7
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)
11
12// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13
14#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
15#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP
16
17#include <boost/geometry/core/coordinate_dimension.hpp>
18#include <boost/geometry/core/coordinate_type.hpp>
19#include <boost/geometry/util/math.hpp>
20
21namespace boost { namespace geometry
22{
23
24#ifndef DOXYGEN_NO_DISPATCH
25namespace detail_dispatch { namespace relate {
26
27// TODO: Integrate it with geometry::less?
28
29template <typename Point1,
30 typename Point2,
31 std::size_t I = 0,
32 std::size_t D = geometry::dimension<Point1>::value>
33struct less
34{
35 static inline bool apply(Point1 const& left, Point2 const& right)
36 {
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);
41
42 if ( geometry::math::equals(cleft, cright) )
43 {
44 return less<Point1, Point2, I + 1, D>::apply(left, right);
45 }
46 else
47 {
48 return cleft < cright;
49 }
50 }
51};
52
53template <typename Point1, typename Point2, std::size_t D>
54struct less<Point1, Point2, D, D>
55{
56 static inline bool apply(Point1 const&, Point2 const&)
57 {
58 return false;
59 }
60};
61
62}} // namespace detail_dispatch::relate
63
64#endif
65
66#ifndef DOXYGEN_NO_DETAIL
67namespace detail { namespace relate {
68
69struct less
70{
71 template <typename Point1, typename Point2>
72 inline bool operator()(Point1 const& point1, Point2 const& point2) const
73 {
74 return detail_dispatch::relate::less<Point1, Point2>::apply(point1, point2);
75 }
76};
77
78}} // namespace detail::relate
79#endif // DOXYGEN_NO_DETAIL
80
81}} // namespace boost::geometry
82
83#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_RELATE_LESS_HPP