annotate DEPENDENCIES/generic/include/boost/numeric/interval/compare/lexicographic.hpp @ 125:34e428693f5d vext

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