From ff905cc506921189f0da1dd7c6e95c0312e3c21a Mon Sep 17 00:00:00 2001 From: Michael Stevens Date: Mon, 23 Aug 2004 07:38:07 +0000 Subject: [PATCH] removed experimental type_traits:const_reference element_proxy: add comparison dropped unnecessary overloads svn path=/trunk/boost/boost/numeric/ublas/; revision=24656 --- .../boost/numeric/ublas/storage_sparse.hpp | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/include/boost/numeric/ublas/storage_sparse.hpp b/include/boost/numeric/ublas/storage_sparse.hpp index 2aaf7d60..9361f22c 100644 --- a/include/boost/numeric/ublas/storage_sparse.hpp +++ b/include/boost/numeric/ublas/storage_sparse.hpp @@ -160,6 +160,13 @@ namespace boost { namespace numeric { namespace ublas { } // Assignment + BOOST_UBLAS_INLINE + sparse_storage_element &operator = (const sparse_storage_element &p) { + // Overide the implict copy assignment + d_ = p.d_; + dirty_ = true; + return *this; + } template BOOST_UBLAS_INLINE sparse_storage_element &operator = (const D &d) { @@ -167,12 +174,6 @@ namespace boost { namespace numeric { namespace ublas { dirty_ = true; return *this; } - BOOST_UBLAS_INLINE - sparse_storage_element &operator = (const sparse_storage_element &p) { - d_ = p.d_; - dirty_ = true; - return *this; - } template BOOST_UBLAS_INLINE sparse_storage_element &operator += (const D &d) { @@ -180,12 +181,6 @@ namespace boost { namespace numeric { namespace ublas { dirty_ = true; return *this; } - BOOST_UBLAS_INLINE - sparse_storage_element &operator += (const sparse_storage_element &p) { - d_ += p.d_; - dirty_ = true; - return *this; - } template BOOST_UBLAS_INLINE sparse_storage_element &operator -= (const D &d) { @@ -193,12 +188,6 @@ namespace boost { namespace numeric { namespace ublas { dirty_ = true; return *this; } - BOOST_UBLAS_INLINE - sparse_storage_element &operator -= (const sparse_storage_element &p) { - d_ -= p.d_; - dirty_ = true; - return *this; - } template BOOST_UBLAS_INLINE sparse_storage_element &operator *= (const D &d) { @@ -206,12 +195,6 @@ namespace boost { namespace numeric { namespace ublas { dirty_ = true; return *this; } - BOOST_UBLAS_INLINE - sparse_storage_element &operator *= (const sparse_storage_element &p) { - d_ *= p.d_; - dirty_ = true; - return *this; - } template BOOST_UBLAS_INLINE sparse_storage_element &operator /= (const D &d) { @@ -219,11 +202,17 @@ namespace boost { namespace numeric { namespace ublas { dirty_ = true; return *this; } + + // Comparison + template BOOST_UBLAS_INLINE - sparse_storage_element &operator /= (const sparse_storage_element &p) { - d_ /= p.d_; - dirty_ = true; - return *this; + bool operator == (const D &d) const { + return d_ == d; + } + template + BOOST_UBLAS_INLINE + bool operator != (const D &d) const { + return d_ != d; } // Conversion @@ -269,8 +258,7 @@ namespace boost { namespace numeric { namespace ublas { typedef std::ptrdiff_t difference_type; typedef I index_type; typedef T data_value_type; - // typedef const T &data_const_reference; - typedef typename type_traits::const_reference data_const_reference; + typedef const T &data_const_reference; #ifndef BOOST_UBLAS_STRICT_STORAGE_SPARSE typedef T &data_reference; #else