fix doc example typo
[boost.git] / boost / numeric / interval / compare / certain.hpp
blob9232d5cd8809ba6a09c46d47f17c2b1b55220c3a
1 /* Boost interval/compare/certain.hpp template implementation file
3 * Copyright 2003 Guillaume Melquiond
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 */
10 #ifndef BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP
11 #define BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP
13 #include <boost/numeric/interval/detail/interval_prototype.hpp>
14 #include <boost/numeric/interval/detail/test_input.hpp>
16 namespace boost {
17 namespace numeric {
18 namespace interval_lib {
19 namespace compare {
20 namespace certain {
22 template<class T, class Policies1, class Policies2> inline
23 bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
25 if (detail::test_input(x, y)) throw comparison_error();
26 return x.upper() < y.lower();
29 template<class T, class Policies> inline
30 bool operator<(const interval<T, Policies>& x, const T& y)
32 if (detail::test_input(x, y)) throw comparison_error();
33 return x.upper() < y;
36 template<class T, class Policies1, class Policies2> inline
37 bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
39 if (detail::test_input(x, y)) throw comparison_error();
40 return x.upper() <= y.lower();
43 template<class T, class Policies> inline
44 bool operator<=(const interval<T, Policies>& x, const T& y)
46 if (detail::test_input(x, y)) throw comparison_error();
47 return x.upper() <= y;
50 template<class T, class Policies1, class Policies2> inline
51 bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
53 if (detail::test_input(x, y)) throw comparison_error();
54 return x.lower() > y.upper();
57 template<class T, class Policies> inline
58 bool operator>(const interval<T, Policies>& x, const T& y)
60 if (detail::test_input(x, y)) throw comparison_error();
61 return x.lower() > y;
64 template<class T, class Policies1, class Policies2> inline
65 bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
67 if (detail::test_input(x, y)) throw comparison_error();
68 return x.lower() >= y.upper();
71 template<class T, class Policies> inline
72 bool operator>=(const interval<T, Policies>& x, const T& y)
74 if (detail::test_input(x, y)) throw comparison_error();
75 return x.lower() >= y;
78 template<class T, class Policies1, class Policies2> inline
79 bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
81 if (detail::test_input(x, y)) throw comparison_error();
82 return x.upper() == y.lower() && x.lower() == y.upper();
85 template<class T, class Policies> inline
86 bool operator==(const interval<T, Policies>& x, const T& y)
88 if (detail::test_input(x, y)) throw comparison_error();
89 return x.upper() == y && x.lower() == y;
92 template<class T, class Policies1, class Policies2> inline
93 bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
95 if (detail::test_input(x, y)) throw comparison_error();
96 return x.upper() < y.lower() || x.lower() > y.upper();
99 template<class T, class Policies> inline
100 bool operator!=(const interval<T, Policies>& x, const T& y)
102 if (detail::test_input(x, y)) throw comparison_error();
103 return x.upper() < y || x.lower() > y;
106 } // namespace certain
107 } // namespace compare
108 } // namespace interval_lib
109 } // namespace numeric
110 } // namespace boost
113 #endif // BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP