| 71 | ~dynamic_repeated_array() = default; |
| 72 | |
| 73 | class iterator |
| 74 | { |
| 75 | public: |
| 76 | iterator(const array& a, int64_t index) |
| 77 | : array_(a) |
| 78 | , index_(index) |
| 79 | { |
| 80 | } |
| 81 | |
| 82 | void operator++() |
| 83 | { |
| 84 | ++index_; |
| 85 | } |
| 86 | |
| 87 | void operator--() |
| 88 | { |
| 89 | --index_; |
| 90 | } |
| 91 | |
| 92 | void operator+=(std::ptrdiff_t n) |
| 93 | { |
| 94 | index_ += n; |
| 95 | } |
| 96 | |
| 97 | void operator-=(std::ptrdiff_t n) |
| 98 | { |
| 99 | index_ -= n; |
| 100 | } |
| 101 | |
| 102 | std::ptrdiff_t operator-(const iterator& other) const |
| 103 | { |
| 104 | return index_ - other.index_; |
| 105 | } |
| 106 | |
| 107 | bool operator==(const iterator& other) const |
| 108 | { |
| 109 | return index_ == other.index_; |
| 110 | } |
| 111 | |
| 112 | array operator*() const |
| 113 | { |
| 114 | return array_; |
| 115 | } |
| 116 | |
| 117 | private: |
| 118 | const array& array_; |
| 119 | int64_t index_ = 0; |
| 120 | }; |
| 121 | |
| 122 | iterator begin() const |
| 123 | { |