Chris@16: /* Boost interval/compare/certain.hpp template implementation file Chris@16: * Chris@16: * Copyright 2003 Guillaume Melquiond 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_CERTAIN_HPP Chris@16: #define BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace numeric { Chris@16: namespace interval_lib { Chris@16: namespace compare { Chris@16: namespace certain { Chris@16: Chris@16: template inline Chris@16: bool operator<(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() < y.lower(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator<(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() < y; Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator<=(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() <= y.lower(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator<=(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() <= y; Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator>(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.lower() > y.upper(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator>(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.lower() > y; Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator>=(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.lower() >= y.upper(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator>=(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.lower() >= y; Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator==(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() == y.lower() && x.lower() == y.upper(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator==(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() == y && x.lower() == y; Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator!=(const interval& x, const interval& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() < y.lower() || x.lower() > y.upper(); Chris@16: } Chris@16: Chris@16: template inline Chris@16: bool operator!=(const interval& x, const T& y) Chris@16: { Chris@16: if (detail::test_input(x, y)) throw comparison_error(); Chris@16: return x.upper() < y || x.lower() > y; Chris@16: } Chris@16: Chris@16: } // namespace certain Chris@16: } // namespace compare Chris@16: } // namespace interval_lib Chris@16: } // namespace numeric Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_NUMERIC_INTERVAL_COMPARE_CERTAIN_HPP