From ffbfa4718194524c14a2b33b3c00f162b66eecde Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Tue, 20 Jun 2006 18:55:30 +0000 Subject: [PATCH] FIX index_pair and index_tripler LessTen Comparable [SVN r34361] --- include/boost/numeric/ublas/storage.hpp | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/boost/numeric/ublas/storage.hpp b/include/boost/numeric/ublas/storage.hpp index 54bf2274..c5ec770f 100644 --- a/include/boost/numeric/ublas/storage.hpp +++ b/include/boost/numeric/ublas/storage.hpp @@ -1582,10 +1582,15 @@ namespace boost { namespace numeric { namespace ublas { bool equal(const self_type& rhs) const { return (v1_ == rhs.v1_); } + BOOST_UBLAS_INLINE bool less(const self_type& rhs) const { return (v1_ < rhs.v1_); } BOOST_UBLAS_INLINE + bool greater(const self_type& rhs) const { + return (v1_ > rhs.v1_); + } + BOOST_UBLAS_INLINE friend bool operator == (const self_type& lhs, const self_type& rhs) { return lhs.equal(rhs); } @@ -1597,6 +1602,18 @@ namespace boost { namespace numeric { namespace ublas { friend bool operator < (const self_type& lhs, const self_type& rhs) { return lhs.less(rhs); } + BOOST_UBLAS_INLINE + friend bool operator >= (const self_type& lhs, const self_type& rhs) { + return !lhs.less(rhs); + } + BOOST_UBLAS_INLINE + friend bool operator > (const self_type& lhs, const self_type& rhs) { + return lhs.greater(rhs); + } + BOOST_UBLAS_INLINE + friend bool operator <= (const self_type& lhs, const self_type& rhs) { + return !lhs.greater(rhs); + } private: size_type i_; @@ -1747,6 +1764,11 @@ namespace boost { namespace numeric { namespace ublas { (v1_ == rhs.v1_ && v2_ < rhs.v2_)); } BOOST_UBLAS_INLINE + bool greater(const self_type& rhs) const { + return ((v1_ > rhs.v1_) || + (v1_ == rhs.v1_ && v2_ > rhs.v2_)); + } + BOOST_UBLAS_INLINE friend bool operator == (const self_type& lhs, const self_type& rhs) { return lhs.equal(rhs); } @@ -1758,6 +1780,18 @@ namespace boost { namespace numeric { namespace ublas { friend bool operator < (const self_type& lhs, const self_type& rhs) { return lhs.less(rhs); } + BOOST_UBLAS_INLINE + friend bool operator >= (const self_type& lhs, const self_type& rhs) { + return !lhs.less(rhs); + } + BOOST_UBLAS_INLINE + friend bool operator > (const self_type& lhs, const self_type& rhs) { + return lhs.greater(rhs); + } + BOOST_UBLAS_INLINE + friend bool operator <= (const self_type& lhs, const self_type& rhs) { + return !lhs.greater(rhs); + } private: size_type i_;