Fix postincrement in truncating and counting iterators
This commit is contained in:
1 parent
4bc26f0a7b
commit
1b8a7f8fa0
3 files changed
+28
-13
No files matched your search
+10
-2
@@ -840,7 +840,11 @@ class counting_iterator {
|
||||
return *this;
|
||||
}
|
||||
|
||||
counting_iterator operator++(int) { return ++*this; }
|
||||
counting_iterator operator++(int) {
|
||||
auto it = *this;
|
||||
++*this;
|
||||
return it;
|
||||
}
|
||||
|
||||
T &operator*() const { return blackhole_; }
|
||||
};
|
||||
@@ -877,7 +881,11 @@ class truncating_iterator {
|
||||
return *this;
|
||||
}
|
||||
|
||||
truncating_iterator operator++(int) { return ++*this; }
|
||||
truncating_iterator operator++(int) {
|
||||
auto it = *this;
|
||||
++*this;
|
||||
return it;
|
||||
}
|
||||
|
||||
reference operator*() const { return count_ < limit_ ? *out_ : blackhole_; }
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user