From e9385ff6e370958f2723623eba2ba6ddd4bbde3d Mon Sep 17 00:00:00 2001 From: mooophy Date: Thu, 4 Dec 2014 14:48:09 +1300 Subject: [PATCH] clearup codes for debug --- .../as1/assignment01_159201_final_version.cpp | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/assignment1/as1/assignment01_159201_final_version.cpp b/assignment1/as1/assignment01_159201_final_version.cpp index bacc20a..0c7de40 100644 --- a/assignment1/as1/assignment01_159201_final_version.cpp +++ b/assignment1/as1/assignment01_159201_final_version.cpp @@ -84,7 +84,6 @@ class SparseMatrix { friend SparseMatrix operator+ (SparseMatrix const& lhs, SparseMatrix const& rhs); - friend std::ostream& operator<< (std::ostream& os, SparseMatrix const& rhs); @@ -93,10 +92,6 @@ public: using IndexType = decltype(Node::row); using SizeType = std::size_t; - SparseMatrix(SparseMatrix const&) = delete; - SparseMatrix& operator=(SparseMatrix const&) = delete; - SparseMatrix& operator=(SparseMatrix &&) = delete; - //! default Ctor SparseMatrix(): head_{nullptr}, tail_{nullptr}, rows_{0}, cols_{0} @@ -121,7 +116,6 @@ public: m.head_ = m.tail_ = nullptr; } - bool empty()const { return !head_ and !tail_; @@ -142,7 +136,13 @@ public: deallocate_data(); } + SparseMatrix(SparseMatrix const&) = delete; + SparseMatrix& operator=(SparseMatrix const&) = delete; + SparseMatrix& operator=(SparseMatrix &&) = delete; + + private: + Node* head_; Node* tail_; SizeType rows_; @@ -161,14 +161,15 @@ private: */ void add(Node && node) { - if(empty()){ - head_ = tail_ = new Node(std::move(node)); + if(empty()) + { + head_ = tail_ = new Node(std::move(node)); } - else{ - tail_->next = new Node(std::move(node)); - tail_ = tail_->next; + else + { + tail_->next = new Node(std::move(node)); + tail_ = tail_->next; } -// std::cout << "ads> added:" << *tail_ << std::endl; } /** @@ -180,7 +181,6 @@ private: std::getline(ifs, line); std::stringstream stream{line}; stream >> rows_ >> cols_; -// std::cout << "Matrix dimensions " << rows_ << " " << cols_ << std::endl; return ifs; }