From 601d8c66a037c59c2c60c6ee4481496699b1d461 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Wed, 9 Mar 2016 11:48:12 +0100 Subject: [PATCH] [cleanup] Remove obsolete 'data' field from the row iterators --- dune/istl/matrix.hh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/dune/istl/matrix.hh b/dune/istl/matrix.hh index 326ef7481..50600714c 100644 --- a/dune/istl/matrix.hh +++ b/dune/istl/matrix.hh @@ -260,7 +260,6 @@ namespace MatrixImp Iterator () : window_(nullptr,0) { - data_ = nullptr; i = 0; } @@ -269,14 +268,13 @@ namespace MatrixImp //! constructor Iterator (B* data, size_type columns, size_type _i) - : data_(data), i(_i), + : i(_i), window_(data + _i*columns, columns) {} /** \brief Move assignment */ Iterator& operator=(Iterator&& other) { - data_ = other.data_; i = other.i; // Do NOT use window_.operator=, because that copies the window content, not just the window! window_.set(other.window_.getsize(),other.window_.getptr()); @@ -286,7 +284,6 @@ namespace MatrixImp /** \brief Copy assignment */ Iterator& operator=(Iterator& other) { - data_ = other.data_; i = other.i; // Do NOT use window_.operator=, because that copies the window content, not just the window! window_.set(other.window_.getsize(),other.window_.getptr()); @@ -354,7 +351,6 @@ namespace MatrixImp friend class ConstIterator; private: - B* data_; size_type i; mutable window_type window_; }; @@ -405,24 +401,22 @@ namespace MatrixImp ConstIterator () : window_(nullptr,0) { - data_ = nullptr; i = 0; } //! constructor from pointer ConstIterator (const B* data, size_type columns, size_type _i) - : data_(data), i(_i), + : i(_i), window_(const_cast<B*>(data + _i * columns), columns) {} //! constructor from non_const iterator ConstIterator (const Iterator& it) - : data_(it.data_), i(it.i), window_(it.window_.getptr(),it.window_.getsize()) + : i(it.i), window_(it.window_.getptr(),it.window_.getsize()) {} ConstIterator& operator=(Iterator&& other) { - data_ = other.data_; i = other.i; // Do NOT use window_.operator=, because that copies the window content, not just the window! window_.set(other.window_.getsize(),other.window_.getptr()); @@ -431,7 +425,6 @@ namespace MatrixImp ConstIterator& operator=(Iterator& other) { - data_ = other.data_; i = other.i; // Do NOT use window_.operator=, because that copies the window content, not just the window! window_.set(other.window_.getsize(),other.window_.getptr()); @@ -499,7 +492,6 @@ namespace MatrixImp friend class Iterator; private: - const B* data_; size_type i; mutable window_type window_; }; -- GitLab