]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/numeric/interval/include/boost/numeric/interval/compare/lexicographic.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / numeric / interval / include / boost / numeric / interval / compare / lexicographic.hpp
CommitLineData
7c673cae
FG
1/* Boost interval/compare/lexicographic.hpp template implementation file
2 *
3 * Copyright 2002-2003 Guillaume Melquiond
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE_1_0.txt or
7 * copy at http://www.boost.org/LICENSE_1_0.txt)
8 */
9
10#ifndef BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP
11#define BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP
12
13#include <boost/numeric/interval/detail/interval_prototype.hpp>
14#include <boost/numeric/interval/detail/test_input.hpp>
15
16namespace boost {
17namespace numeric {
18namespace interval_lib {
19namespace compare {
20namespace lexicographic {
21
22template<class T, class Policies1, class Policies2> inline
23bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
24{
25 if (detail::test_input(x, y)) throw comparison_error();
26 const T& xl = x.lower();
27 const T& yl = y.lower();
28 return xl < yl || (xl == yl && x.upper() < y.upper());
29}
30
31template<class T, class Policies> inline
32bool operator<(const interval<T, Policies>& x, const T& y)
33{
34 if (detail::test_input(x, y)) throw comparison_error();
35 return x.lower() < y;
36}
37
38template<class T, class Policies1, class Policies2> inline
39bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
40{
41 if (detail::test_input(x, y)) throw comparison_error();
42 const T& xl = x.lower();
43 const T& yl = y.lower();
44 return xl < yl || (xl == yl && x.upper() <= y.upper());
45}
46
47template<class T, class Policies> inline
48bool operator<=(const interval<T, Policies>& x, const T& y)
49{
50 if (detail::test_input(x, y)) throw comparison_error();
51 const T& xl = x.lower();
52 return xl < y || (xl == y && x.upper() <= y);
53}
54
55template<class T, class Policies1, class Policies2> inline
56bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
57{
58 if (detail::test_input(x, y)) throw comparison_error();
59 const T& xl = x.lower();
60 const T& yl = y.lower();
61 return xl > yl || (xl == yl && x.upper() > y.upper());
62}
63
64template<class T, class Policies> inline
65bool operator>(const interval<T, Policies>& x, const T& y)
66{
67 if (detail::test_input(x, y)) throw comparison_error();
68 const T& xl = x.lower();
69 return xl > y || (xl == y && x.upper() > y);
70}
71
72template<class T, class Policies1, class Policies2> inline
73bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
74{
75 if (detail::test_input(x, y)) throw comparison_error();
76 const T& xl = x.lower();
77 const T& yl = y.lower();
78 return xl > yl || (xl == yl && x.upper() >= y.upper());
79}
80
81template<class T, class Policies> inline
82bool operator>=(const interval<T, Policies>& x, const T& y)
83{
84 if (detail::test_input(x, y)) throw comparison_error();
85 return x.lower() >= y;
86}
87
88template<class T, class Policies1, class Policies2> inline
89bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
90{
91 if (detail::test_input(x, y)) throw comparison_error();
92 return x.lower() == y.lower() && x.upper() == y.upper();
93}
94
95template<class T, class Policies> inline
96bool operator==(const interval<T, Policies>& x, const T& y)
97{
98 if (detail::test_input(x, y)) throw comparison_error();
99 return x.lower() == y && x.upper() == y;
100}
101
102template<class T, class Policies1, class Policies2> inline
103bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
104{
105 if (detail::test_input(x, y)) throw comparison_error();
106 return x.lower() != y.lower() || x.upper() != y.upper();
107}
108
109template<class T, class Policies> inline
110bool operator!=(const interval<T, Policies>& x, const T& y)
111{
112 if (detail::test_input(x, y)) throw comparison_error();
113 return x.lower() != y || x.upper() != y;
114}
115
116} // namespace lexicographic
117} // namespace compare
118} // namespace interval_lib
119} // namespace numeric
120} // namespace boost
121
122#endif // BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP