[PPL-devel] [GIT] ppl/ppl(sparse_matrices): Sparse_Row, Sparse_Row_Reference: add assignment operator from Unlimited_Sparse_Row.
Marco Poletti
poletti.marco at gmail.com
Tue Mar 9 22:16:05 CET 2010
Module: ppl/ppl
Branch: sparse_matrices
Commit: 109aa87b6c2878e98a11aa6de74c859d6bb7ba89
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=109aa87b6c2878e98a11aa6de74c859d6bb7ba89
Author: Marco Poletti <poletti.marco at gmail.com>
Date: Tue Mar 9 22:14:45 2010 +0100
Sparse_Row, Sparse_Row_Reference: add assignment operator from Unlimited_Sparse_Row.
---
src/Sparse_Row.defs.hh | 7 +++++++
src/Sparse_Row.inlines.hh | 14 ++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/Sparse_Row.defs.hh b/src/Sparse_Row.defs.hh
index 16268c2..29f7374 100644
--- a/src/Sparse_Row.defs.hh
+++ b/src/Sparse_Row.defs.hh
@@ -72,6 +72,10 @@ public:
Sparse_Row(const Sparse_Row_Reference& x);
//! Assigns a Sparse_Row_Reference to (*this).
+ //! x should have no nonzero elements with index greater than size().
+ Sparse_Row& operator=(const Unlimited_Sparse_Row& x);
+
+ //! Assigns a Sparse_Row_Reference to (*this).
Sparse_Row& operator=(const Sparse_Row_Reference& x);
//! Swaps (*this) and x.
@@ -201,6 +205,9 @@ public:
Sparse_Row_Reference(Unlimited_Sparse_Row& row,const dimension_type size);
+ Sparse_Row_Reference& operator=(const Unlimited_Sparse_Row& x);
+
+ //! x should have no nonzero elements with index greater than size().
Sparse_Row_Reference& operator=(const Sparse_Row_Reference& x);
Sparse_Row_Reference& operator=(const Sparse_Row& x);
diff --git a/src/Sparse_Row.inlines.hh b/src/Sparse_Row.inlines.hh
index 3301485..1a4550c 100644
--- a/src/Sparse_Row.inlines.hh
+++ b/src/Sparse_Row.inlines.hh
@@ -56,6 +56,13 @@ Sparse_Row::Sparse_Row(const Sparse_Row_Reference& x)
}
inline Sparse_Row&
+Sparse_Row::operator=(const Unlimited_Sparse_Row& x) {
+ row = x;
+ PPL_ASSERT(OK());
+ return *this;
+}
+
+inline Sparse_Row&
Sparse_Row::operator=(const Sparse_Row_Reference& x) {
Sparse_Row_Reference(row,size_) = x;
return *this;
@@ -284,6 +291,13 @@ Sparse_Row_Reference::Sparse_Row_Reference(Unlimited_Sparse_Row& row1,
}
inline Sparse_Row_Reference&
+Sparse_Row_Reference::operator=(const Unlimited_Sparse_Row& x) {
+ row = x;
+ PPL_ASSERT(OK());
+ return *this;
+}
+
+inline Sparse_Row_Reference&
Sparse_Row_Reference::operator=(const Sparse_Row_Reference& x) {
PPL_ASSERT(size_ == x.size_);
row = x.row;
More information about the PPL-devel
mailing list