File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- #ifndef REPEAT_HPP__
2- #define REPEAT_HPP__
1+ #ifndef ITER_REPEAT_HPP_
2+ #define ITER_REPEAT_HPP_
33
44#include < iterator>
55#include < utility>
@@ -28,7 +28,7 @@ namespace iter {
2828 { }
2929 public:
3030
31- class Iterator {
31+ class Iterator : public std ::iterator<std::input_iterator_tag, T> {
3232 private:
3333 T& elem;
3434 int count;
@@ -49,11 +49,21 @@ namespace iter {
4949 return *this ;
5050 }
5151
52+ Iterator operator ++(int ) {
53+ auto ret = *this ;
54+ ++*this ;
55+ return ret;
56+ }
57+
5258 bool operator !=(const Iterator& other) const {
5359 return this ->count != other.count ||
5460 &this ->elem != &other.elem ;
5561 }
5662
63+ bool operator ==(const Iterator& other) const {
64+ return !(*this != other);
65+ }
66+
5767 T& operator *() {
5868 return this ->elem ;
5969 }
@@ -76,4 +86,4 @@ namespace iter {
7686
7787}
7888
79- #endif // REPEAT_HPP__
89+ #endif
You can’t perform that action at this time.
0 commit comments