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