From 1ec1b8d36fc7b6828415ad3e52d3fedc7624faea Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Mon, 3 Feb 2020 14:24:31 +0100 Subject: [PATCH] Use default copy constructors and assignment operators where possible --- src/OpenVolumeMesh/Core/Iterators.hh | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/OpenVolumeMesh/Core/Iterators.hh b/src/OpenVolumeMesh/Core/Iterators.hh index b00c94a..a1a11bf 100644 --- a/src/OpenVolumeMesh/Core/Iterators.hh +++ b/src/OpenVolumeMesh/Core/Iterators.hh @@ -79,7 +79,11 @@ public: // STL compliance (needs to have default constructor) BaseIterator() : valid_(false), mesh_(nullptr) {} + BaseIterator(const BaseIterator& _c) = default; virtual ~BaseIterator() = default; + + BaseIterator& operator=(const BaseIterator& _c) = default; + bool operator== (const BaseIterator& _c) const { return (this->cur_handle_ == _c.cur_handle() && this->valid_ == _c.valid() && @@ -101,13 +105,6 @@ public: return cur_handle_.idx() < _c.cur_handle_.idx(); } - BaseIterator& operator=(const BaseIterator& _c) { - this->valid_ = _c.valid(); - this->cur_handle_ = _c.cur_handle(); - this->mesh_ = _c.mesh(); - return *this; - } - operator bool() const { return valid_; } @@ -189,6 +186,7 @@ public: lap_(0), max_laps_(1) {} + BaseCirculator(const BaseCirculator& _c) = default; virtual ~BaseCirculator() = default; @@ -208,13 +206,7 @@ public: return lap_ < _c.lap_; } - BaseCirculator& operator=(const BaseCirculator& _c) { - BaseIter::operator=(_c); - this->ref_handle_ = _c.ref_handle(); - this->lap_ = _c.lap_; - this->max_laps_ = _c.max_laps_; - return *this; - } + BaseCirculator& operator=(const BaseCirculator& _c) = default; const IH& ref_handle() const { return ref_handle_; -- GitLab