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:
parent
787c819b77
commit
52a2178ac1
3 changed files with 14 additions and 14 deletions
|
@ -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];
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue