diff --git a/sprout/iterator/index_iterator.hpp b/sprout/iterator/index_iterator.hpp index ca5b32f7..95c098ef 100644 --- a/sprout/iterator/index_iterator.hpp +++ b/sprout/iterator/index_iterator.hpp @@ -147,13 +147,13 @@ namespace sprout { } index_iterator& operator+=(difference_type n) { index_iterator temp(holder_, index_ + n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } index_iterator& operator-=(difference_type n) { index_iterator temp(holder_, index_ - n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } SPROUT_CONSTEXPR reference operator[](difference_type n) const { return holder_.get()[index_ + n]; diff --git a/sprout/iterator/reverse_iterator.hpp b/sprout/iterator/reverse_iterator.hpp index 4a94bddf..ce61d190 100644 --- a/sprout/iterator/reverse_iterator.hpp +++ b/sprout/iterator/reverse_iterator.hpp @@ -47,8 +47,8 @@ namespace sprout { template reverse_iterator& operator=(reverse_iterator const& it) { reverse_iterator temp(it); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } SPROUT_CONSTEXPR iterator_type base() const { return current; @@ -89,13 +89,13 @@ namespace sprout { } reverse_iterator& operator+=(difference_type n) { reverse_iterator temp(current - n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } reverse_iterator& operator-=(difference_type n) { reverse_iterator temp(current + n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } SPROUT_CONSTEXPR reference operator[](difference_type n) const { return *(deref_tmp - n); diff --git a/sprout/iterator/value_iterator.hpp b/sprout/iterator/value_iterator.hpp index 9ea787b8..9619f330 100644 --- a/sprout/iterator/value_iterator.hpp +++ b/sprout/iterator/value_iterator.hpp @@ -136,13 +136,13 @@ namespace sprout { } value_iterator& operator+=(difference_type n) { value_iterator temp(holder_, count_ - n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } value_iterator& operator-=(difference_type n) { value_iterator temp(holder_, count_ + n); - temp.swap(this); - return this; + temp.swap(*this); + return *this; } SPROUT_CONSTEXPR reference operator[](difference_type n) const { return holder_.get();