1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00

fix bug iterator/*.hpp assignment operator

This commit is contained in:
bolero-MURAKAMI 2012-03-23 23:31:47 +09:00
parent 787c819b77
commit 52a2178ac1
3 changed files with 14 additions and 14 deletions

View file

@ -147,13 +147,13 @@ namespace sprout {
} }
index_iterator& operator+=(difference_type n) { index_iterator& operator+=(difference_type n) {
index_iterator temp(holder_, index_ + n); index_iterator temp(holder_, index_ + n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
index_iterator& operator-=(difference_type n) { index_iterator& operator-=(difference_type n) {
index_iterator temp(holder_, index_ - n); index_iterator temp(holder_, index_ - n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
SPROUT_CONSTEXPR reference operator[](difference_type n) const { SPROUT_CONSTEXPR reference operator[](difference_type n) const {
return holder_.get()[index_ + n]; return holder_.get()[index_ + n];

View file

@ -47,8 +47,8 @@ namespace sprout {
template<typename U> template<typename U>
reverse_iterator& operator=(reverse_iterator<U> const& it) { reverse_iterator& operator=(reverse_iterator<U> const& it) {
reverse_iterator temp(it); reverse_iterator temp(it);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
SPROUT_CONSTEXPR iterator_type base() const { SPROUT_CONSTEXPR iterator_type base() const {
return current; return current;
@ -89,13 +89,13 @@ namespace sprout {
} }
reverse_iterator& operator+=(difference_type n) { reverse_iterator& operator+=(difference_type n) {
reverse_iterator temp(current - n); reverse_iterator temp(current - n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
reverse_iterator& operator-=(difference_type n) { reverse_iterator& operator-=(difference_type n) {
reverse_iterator temp(current + n); reverse_iterator temp(current + n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
SPROUT_CONSTEXPR reference operator[](difference_type n) const { SPROUT_CONSTEXPR reference operator[](difference_type n) const {
return *(deref_tmp - n); return *(deref_tmp - n);

View file

@ -136,13 +136,13 @@ namespace sprout {
} }
value_iterator& operator+=(difference_type n) { value_iterator& operator+=(difference_type n) {
value_iterator temp(holder_, count_ - n); value_iterator temp(holder_, count_ - n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
value_iterator& operator-=(difference_type n) { value_iterator& operator-=(difference_type n) {
value_iterator temp(holder_, count_ + n); value_iterator temp(holder_, count_ + n);
temp.swap(this); temp.swap(*this);
return this; return *this;
} }
SPROUT_CONSTEXPR reference operator[](difference_type n) const { SPROUT_CONSTEXPR reference operator[](difference_type n) const {
return holder_.get(); return holder_.get();