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_;