123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- /* Boost interval/compare/explicit.hpp template implementation file
- *
- * Copyright 2000 Jens Maurer
- * Copyright 2002 Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion
- *
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE_1_0.txt or
- * copy at http://www.boost.org/LICENSE_1_0.txt)
- */
- #ifndef BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP
- #define BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP
- #include <boost/numeric/interval/detail/interval_prototype.hpp>
- namespace boost {
- namespace numeric {
- namespace interval_lib {
- /*
- * Certainly... operations
- */
- template<class T, class Policies1, class Policies2> inline
- bool cerlt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() < y.lower();
- }
- template<class T, class Policies> inline
- bool cerlt(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() < y;
- }
- template<class T, class Policies> inline
- bool cerlt(const T& x, const interval<T, Policies>& y)
- {
- return x < y.lower();
- }
- template<class T, class Policies1, class Policies2> inline
- bool cerle(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() <= y.lower();
- }
- template<class T, class Policies> inline
- bool cerle(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() <= y;
- }
- template<class T, class Policies> inline
- bool cerle(const T& x, const interval<T, Policies>& y)
- {
- return x <= y.lower();
- }
- template<class T, class Policies1, class Policies2> inline
- bool cergt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.lower() > y.upper();
- }
- template<class T, class Policies> inline
- bool cergt(const interval<T, Policies>& x, const T& y)
- {
- return x.lower() > y;
- }
- template<class T, class Policies> inline
- bool cergt(const T& x, const interval<T, Policies>& y)
- {
- return x > y.upper();
- }
- template<class T, class Policies1, class Policies2> inline
- bool cerge(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.lower() >= y.upper();
- }
- template<class T, class Policies> inline
- bool cerge(const interval<T, Policies>& x, const T& y)
- {
- return x.lower() >= y;
- }
- template<class T, class Policies> inline
- bool cerge(const T& x, const interval<T, Policies>& y)
- {
- return x >= y.upper();
- }
- template<class T, class Policies1, class Policies2> inline
- bool cereq(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.lower() == y.upper() && y.lower() == x.upper();
- }
- template<class T, class Policies> inline
- bool cereq(const interval<T, Policies>& x, const T& y)
- {
- return x.lower() == y && x.upper() == y;
- }
- template<class T, class Policies> inline
- bool cereq(const T& x, const interval<T, Policies>& y)
- {
- return x == y.lower() && x == y.upper();
- }
- template<class T, class Policies1, class Policies2> inline
- bool cerne(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() < y.lower() || y.upper() < x.lower();
- }
- template<class T, class Policies> inline
- bool cerne(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() < y || y < x.lower();
- }
- template<class T, class Policies> inline
- bool cerne(const T& x, const interval<T, Policies>& y)
- {
- return x < y.lower() || y.upper() < x;
- }
- /*
- * Possibly... comparisons
- */
- template<class T, class Policies1, class Policies2> inline
- bool poslt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.lower() < y.upper();
- }
- template<class T, class Policies> inline
- bool poslt(const interval<T, Policies>& x, const T& y)
- {
- return x.lower() < y;
- }
- template<class T, class Policies> inline
- bool poslt(const T& x, const interval<T, Policies>& y)
- {
- return x < y.upper();
- }
- template<class T, class Policies1, class Policies2> inline
- bool posle(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.lower() <= y.upper();
- }
- template<class T, class Policies> inline
- bool posle(const interval<T, Policies>& x, const T& y)
- {
- return x.lower() <= y;
- }
- template<class T, class Policies> inline
- bool posle(const T& x, const interval<T, Policies>& y)
- {
- return x <= y.upper();
- }
- template<class T, class Policies1, class Policies2> inline
- bool posgt(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() > y.lower();
- }
- template<class T, class Policies> inline
- bool posgt(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() > y;
- }
- template<class T, class Policies> inline
- bool posgt(const T& x, const interval<T, Policies> & y)
- {
- return x > y.lower();
- }
- template<class T, class Policies1, class Policies2> inline
- bool posge(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() >= y.lower();
- }
- template<class T, class Policies> inline
- bool posge(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() >= y;
- }
- template<class T, class Policies> inline
- bool posge(const T& x, const interval<T, Policies>& y)
- {
- return x >= y.lower();
- }
- template<class T, class Policies1, class Policies2> inline
- bool poseq(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() >= y.lower() && y.upper() >= x.lower();
- }
- template<class T, class Policies> inline
- bool poseq(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() >= y && y >= x.lower();
- }
- template<class T, class Policies> inline
- bool poseq(const T& x, const interval<T, Policies>& y)
- {
- return x >= y.lower() && y.upper() >= x;
- }
- template<class T, class Policies1, class Policies2> inline
- bool posne(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
- {
- return x.upper() != y.lower() || y.upper() != x.lower();
- }
- template<class T, class Policies> inline
- bool posne(const interval<T, Policies>& x, const T& y)
- {
- return x.upper() != y || y != x.lower();
- }
- template<class T, class Policies> inline
- bool posne(const T& x, const interval<T, Policies>& y)
- {
- return x != y.lower() || y.upper() != x;
- }
- } // namespace interval_lib
- } // namespace numeric
- } //namespace boost
- #endif // BOOST_NUMERIC_INTERVAL_COMPARE_EXPLICIT_HPP
|