Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/numeric/interval/compare/lexicographic.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* Boost interval/compare/lexicographic.hpp template implementation file
0002  *
0003  * Copyright 2002-2003 Guillaume Melquiond
0004  *
0005  * Distributed under the Boost Software License, Version 1.0.
0006  * (See accompanying file LICENSE_1_0.txt or
0007  * copy at http://www.boost.org/LICENSE_1_0.txt)
0008  */
0009 
0010 #ifndef BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP
0011 #define BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP
0012 
0013 #include <boost/numeric/interval/detail/interval_prototype.hpp>
0014 #include <boost/numeric/interval/detail/test_input.hpp>
0015 
0016 namespace boost {
0017 namespace numeric {
0018 namespace interval_lib {
0019 namespace compare {
0020 namespace lexicographic {
0021 
0022 template<class T, class Policies1, class Policies2> inline
0023 bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0024 {
0025   if (detail::test_input(x, y)) throw comparison_error();
0026   const T& xl = x.lower();
0027   const T& yl = y.lower();
0028   return xl < yl || (xl == yl && x.upper() < y.upper());
0029 }
0030 
0031 template<class T, class Policies> inline
0032 bool operator<(const interval<T, Policies>& x, const T& y)
0033 {
0034   if (detail::test_input(x, y)) throw comparison_error();
0035   return x.lower() < y;
0036 }
0037 
0038 template<class T, class Policies1, class Policies2> inline
0039 bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0040 {
0041   if (detail::test_input(x, y)) throw comparison_error();
0042   const T& xl = x.lower();
0043   const T& yl = y.lower();
0044   return xl < yl || (xl == yl && x.upper() <= y.upper());
0045 }
0046 
0047 template<class T, class Policies> inline
0048 bool operator<=(const interval<T, Policies>& x, const T& y)
0049 {
0050   if (detail::test_input(x, y)) throw comparison_error();
0051   const T& xl = x.lower();
0052   return xl < y || (xl == y && x.upper() <= y);
0053 }
0054 
0055 template<class T, class Policies1, class Policies2> inline
0056 bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0057 {
0058   if (detail::test_input(x, y)) throw comparison_error();
0059   const T& xl = x.lower();
0060   const T& yl = y.lower();
0061   return xl > yl || (xl == yl && x.upper() > y.upper());
0062 }
0063 
0064 template<class T, class Policies> inline
0065 bool operator>(const interval<T, Policies>& x, const T& y)
0066 {
0067   if (detail::test_input(x, y)) throw comparison_error();
0068   const T& xl = x.lower();
0069   return xl > y || (xl == y && x.upper() > y);
0070 }
0071 
0072 template<class T, class Policies1, class Policies2> inline
0073 bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0074 {
0075   if (detail::test_input(x, y)) throw comparison_error();
0076   const T& xl = x.lower();
0077   const T& yl = y.lower();
0078   return xl > yl || (xl == yl && x.upper() >= y.upper());
0079 }
0080 
0081 template<class T, class Policies> inline
0082 bool operator>=(const interval<T, Policies>& x, const T& y)
0083 {
0084   if (detail::test_input(x, y)) throw comparison_error();
0085   return x.lower() >= y;
0086 }
0087 
0088 template<class T, class Policies1, class Policies2> inline
0089 bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0090 {
0091   if (detail::test_input(x, y)) throw comparison_error();
0092   return x.lower() == y.lower() && x.upper() == y.upper();
0093 }
0094 
0095 template<class T, class Policies> inline
0096 bool operator==(const interval<T, Policies>& x, const T& y)
0097 {
0098   if (detail::test_input(x, y)) throw comparison_error();
0099   return x.lower() == y && x.upper() == y;
0100 }
0101 
0102 template<class T, class Policies1, class Policies2> inline
0103 bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0104 {
0105   if (detail::test_input(x, y)) throw comparison_error();
0106   return x.lower() != y.lower() || x.upper() != y.upper();
0107 }
0108 
0109 template<class T, class Policies> inline
0110 bool operator!=(const interval<T, Policies>& x, const T& y)
0111 {
0112   if (detail::test_input(x, y)) throw comparison_error();
0113   return x.lower() != y || x.upper() != y;
0114 }
0115 
0116 } // namespace lexicographic
0117 } // namespace compare
0118 } // namespace interval_lib
0119 } // namespace numeric
0120 } // namespace boost
0121 
0122 #endif // BOOST_NUMERIC_INTERVAL_COMPARE_LEXICOGRAPHIC_HPP