
Module: ppl/ppl Branch: sparse_matrices Commit: c43588786d85464bc357116785cebebc5fbfc6c7 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=c43588786d854...
Author: Marco Poletti poletti.marco@gmail.com Date: Tue Mar 9 13:33:14 2010 +0100
Dense_Row: make iterator and const_iterator Assignable.
---
src/Dense_Row.defs.hh | 4 ++-- src/Dense_Row.inlines.hh | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/Dense_Row.defs.hh b/src/Dense_Row.defs.hh index 23d3054..44decef 100644 --- a/src/Dense_Row.defs.hh +++ b/src/Dense_Row.defs.hh @@ -280,7 +280,7 @@ public: bool OK() const;
private: - Dense_Row& row; + Dense_Row* row; dimension_type i; };
@@ -305,7 +305,7 @@ public: bool OK() const;
private: - const Dense_Row& row; + const Dense_Row* row; dimension_type i; };
diff --git a/src/Dense_Row.inlines.hh b/src/Dense_Row.inlines.hh index daf8664..7e766d7 100644 --- a/src/Dense_Row.inlines.hh +++ b/src/Dense_Row.inlines.hh @@ -246,25 +246,25 @@ Dense_Row::operator const Row&() const {
inline Dense_Row::iterator::iterator(Dense_Row& row1,dimension_type i1) - : row(row1), i(i1) { + : row(&row1), i(i1) { PPL_ASSERT(OK()); }
inline Dense_Row::iterator::value_type Dense_Row::iterator::operator*() { - PPL_ASSERT(i < row.size()); - return value_type(i,row[i]); + PPL_ASSERT(i < row->size()); + return value_type(i,(*row)[i]); }
inline Dense_Row::iterator::const_type Dense_Row::iterator::operator*() const { - PPL_ASSERT(i < row.size()); - return const_type(i,row[i]); + PPL_ASSERT(i < row->size()); + return const_type(i,(*row)[i]); }
inline Dense_Row::iterator& Dense_Row::iterator::operator++() { - PPL_ASSERT(i < row.size()); + PPL_ASSERT(i < row->size()); ++i; PPL_ASSERT(OK()); return *this; @@ -294,7 +294,7 @@ Dense_Row::iterator::operator--(int) {
inline bool Dense_Row::iterator::operator==(const iterator& x) const { - return (&row == &(x.row)) && (i == x.i); + return (row == x.row) && (i == x.i); }
inline bool @@ -304,31 +304,31 @@ Dense_Row::iterator::operator!=(const iterator& x) const {
inline Dense_Row::iterator::operator const_iterator() const { - return const_iterator(row,i); + return const_iterator(*row,i); }
inline bool Dense_Row::iterator::OK() const { // i can be equal to row.size() for past-the-end iterators - return (i <= row.size()); + return (i <= row->size()); }
inline Dense_Row::const_iterator::const_iterator(const Dense_Row& row1,dimension_type i1) - : row(row1), i(i1) { + : row(&row1), i(i1) { PPL_ASSERT(OK()); }
inline Dense_Row::const_iterator::const_type Dense_Row::const_iterator::operator*() const { - PPL_ASSERT(i < row.size()); - return const_type(i,row[i]); + PPL_ASSERT(i < row->size()); + return const_type(i,(*row)[i]); }
inline Dense_Row::const_iterator& Dense_Row::const_iterator::operator++() { - PPL_ASSERT(i < row.size()); + PPL_ASSERT(i < row->size()); ++i; PPL_ASSERT(OK()); return *this; @@ -358,7 +358,7 @@ Dense_Row::const_iterator::operator--(int) {
inline bool Dense_Row::const_iterator::operator==(const const_iterator& x) const { - return (&row == &(x.row)) && (i == x.i); + return (row == x.row) && (i == x.i); }
inline bool @@ -369,7 +369,7 @@ Dense_Row::const_iterator::operator!=(const const_iterator& x) const { inline bool Dense_Row::const_iterator::OK() const { // i can be equal to row.size() for past-the-end iterators - return (i <= row.size()); + return (i <= row->size()); }
} // namespace Parma_Polyhedra_Library