Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/numeric/interval/compare/possible.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/possible.hpp template implementation file
0002  *
0003  * Copyright 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_POSSIBLE_HPP
0011 #define BOOST_NUMERIC_INTERVAL_COMPARE_POSSIBLE_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 possible {
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   return x.lower() < y.upper();
0027 }
0028 
0029 template<class T, class Policies> inline
0030 bool operator<(const interval<T, Policies>& x, const T& y)
0031 {
0032   if (detail::test_input(x, y)) throw comparison_error();
0033   return x.lower() < y;
0034 }
0035 
0036 template<class T, class Policies1, class Policies2> inline
0037 bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0038 {
0039   if (detail::test_input(x, y)) throw comparison_error();
0040   return x.lower() <= y.upper();
0041 }
0042 
0043 template<class T, class Policies> inline
0044 bool operator<=(const interval<T, Policies>& x, const T& y)
0045 {
0046   if (detail::test_input(x, y)) throw comparison_error();
0047   return x.lower() <= y;
0048 }
0049 
0050 template<class T, class Policies1, class Policies2> inline
0051 bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0052 {
0053   if (detail::test_input(x, y)) throw comparison_error();
0054   return x.upper() > y.lower();
0055 }
0056 
0057 template<class T, class Policies> inline
0058 bool operator>(const interval<T, Policies>& x, const T& y)
0059 {
0060   if (detail::test_input(x, y)) throw comparison_error();
0061   return x.upper() > y;
0062 }
0063 
0064 template<class T, class Policies1, class Policies2> inline
0065 bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0066 {
0067   if (detail::test_input(x, y)) throw comparison_error();
0068   return x.upper() >= y.lower();
0069 }
0070 
0071 template<class T, class Policies> inline
0072 bool operator>=(const interval<T, Policies>& x, const T& y)
0073 {
0074   if (detail::test_input(x, y)) throw comparison_error();
0075   return x.upper() >= y;
0076 }
0077 
0078 template<class T, class Policies1, class Policies2> inline
0079 bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0080 {
0081   if (detail::test_input(x, y)) throw comparison_error();
0082   return x.lower() <= y.upper() && x.upper() >= y.lower();
0083 }
0084 
0085 template<class T, class Policies> inline
0086 bool operator==(const interval<T, Policies>& x, const T& y)
0087 {
0088   if (detail::test_input(x, y)) throw comparison_error();
0089   return x.lower() <= y && x.upper() >= y;
0090 }
0091 
0092 template<class T, class Policies1, class Policies2> inline
0093 bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
0094 {
0095   if (detail::test_input(x, y)) throw comparison_error();
0096   return x.lower() != y.upper() || x.upper() != y.lower();
0097 }
0098 
0099 template<class T, class Policies> inline
0100 bool operator!=(const interval<T, Policies>& x, const T& y)
0101 {
0102   if (detail::test_input(x, y)) throw comparison_error();
0103   return x.lower() != y || x.upper() != y;
0104 }
0105 
0106 } // namespace possible
0107 } // namespace compare
0108 } // namespace interval_lib
0109 } // namespace numeric
0110 } // namespace boost
0111 
0112 
0113 #endif // BOOST_NUMERIC_INTERVAL_COMPARE_POSSIBLE_HPP