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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class `iota_view::iterator` <a id="range.iota.iterator">[[range.iota.iterator]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<weakly_incrementable W, semiregular Bound>
|
| 6 |
+
requires weakly-equality-comparable-with<W, Bound>
|
| 7 |
+
struct iota_view<W, Bound>::iterator {
|
| 8 |
+
private:
|
| 9 |
+
W value_ = W(); // exposition only
|
| 10 |
+
public:
|
| 11 |
+
using iterator_concept = see below;
|
| 12 |
+
using iterator_category = input_iterator_tag;
|
| 13 |
+
using value_type = W;
|
| 14 |
+
using difference_type = IOTA-DIFF-T(W);
|
| 15 |
+
|
| 16 |
+
iterator() = default;
|
| 17 |
+
constexpr explicit iterator(W value);
|
| 18 |
+
|
| 19 |
+
constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v<W>);
|
| 20 |
+
|
| 21 |
+
constexpr iterator& operator++();
|
| 22 |
+
constexpr void operator++(int);
|
| 23 |
+
constexpr iterator operator++(int) requires incrementable<W>;
|
| 24 |
+
|
| 25 |
+
constexpr iterator& operator--() requires decrementable<W>;
|
| 26 |
+
constexpr iterator operator--(int) requires decrementable<W>;
|
| 27 |
+
|
| 28 |
+
constexpr iterator& operator+=(difference_type n)
|
| 29 |
+
requires advanceable<W>;
|
| 30 |
+
constexpr iterator& operator-=(difference_type n)
|
| 31 |
+
requires advanceable<W>;
|
| 32 |
+
constexpr W operator[](difference_type n) const
|
| 33 |
+
requires advanceable<W>;
|
| 34 |
+
|
| 35 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y)
|
| 36 |
+
requires equality_comparable<W>;
|
| 37 |
+
|
| 38 |
+
friend constexpr bool operator<(const iterator& x, const iterator& y)
|
| 39 |
+
requires totally_ordered<W>;
|
| 40 |
+
friend constexpr bool operator>(const iterator& x, const iterator& y)
|
| 41 |
+
requires totally_ordered<W>;
|
| 42 |
+
friend constexpr bool operator<=(const iterator& x, const iterator& y)
|
| 43 |
+
requires totally_ordered<W>;
|
| 44 |
+
friend constexpr bool operator>=(const iterator& x, const iterator& y)
|
| 45 |
+
requires totally_ordered<W>;
|
| 46 |
+
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
|
| 47 |
+
requires totally_ordered<W> && three_way_comparable<W>;
|
| 48 |
+
|
| 49 |
+
friend constexpr iterator operator+(iterator i, difference_type n)
|
| 50 |
+
requires advanceable<W>;
|
| 51 |
+
friend constexpr iterator operator+(difference_type n, iterator i)
|
| 52 |
+
requires advanceable<W>;
|
| 53 |
+
|
| 54 |
+
friend constexpr iterator operator-(iterator i, difference_type n)
|
| 55 |
+
requires advanceable<W>;
|
| 56 |
+
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
|
| 57 |
+
requires advanceable<W>;
|
| 58 |
+
};
|
| 59 |
+
}
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
`iterator::iterator_concept` is defined as follows:
|
| 63 |
+
|
| 64 |
+
- If `W` models `advanceable`, then `iterator_concept` is
|
| 65 |
+
`random_access_iterator_tag`.
|
| 66 |
+
- Otherwise, if `W` models `decrementable`, then `iterator_concept` is
|
| 67 |
+
`bidirectional_iterator_tag`.
|
| 68 |
+
- Otherwise, if `W` models `incrementable`, then `iterator_concept` is
|
| 69 |
+
`forward_iterator_tag`.
|
| 70 |
+
- Otherwise, `iterator_concept` is `input_iterator_tag`.
|
| 71 |
+
|
| 72 |
+
[*Note 1*: Overloads for `iter_move` and `iter_swap` are omitted
|
| 73 |
+
intentionally. — *end note*]
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
constexpr explicit iterator(W value);
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
*Effects:* Initializes *value\_* with `value`.
|
| 80 |
+
|
| 81 |
+
``` cpp
|
| 82 |
+
constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v<W>);
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
*Effects:* Equivalent to: `return `*`value_`*`;`
|
| 86 |
+
|
| 87 |
+
[*Note 1*: The `noexcept` clause is needed by the default `iter_move`
|
| 88 |
+
implementation. — *end note*]
|
| 89 |
+
|
| 90 |
+
``` cpp
|
| 91 |
+
constexpr iterator& operator++();
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
*Effects:* Equivalent to:
|
| 95 |
+
|
| 96 |
+
``` cpp
|
| 97 |
+
++value_;
|
| 98 |
+
return *this;
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
``` cpp
|
| 102 |
+
constexpr void operator++(int);
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
*Effects:* Equivalent to `++*this`.
|
| 106 |
+
|
| 107 |
+
``` cpp
|
| 108 |
+
constexpr iterator operator++(int) requires incrementable<W>;
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
*Effects:* Equivalent to:
|
| 112 |
+
|
| 113 |
+
``` cpp
|
| 114 |
+
auto tmp = *this;
|
| 115 |
+
++*this;
|
| 116 |
+
return tmp;
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
``` cpp
|
| 120 |
+
constexpr iterator& operator--() requires decrementable<W>;
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
*Effects:* Equivalent to:
|
| 124 |
+
|
| 125 |
+
``` cpp
|
| 126 |
+
--value_;
|
| 127 |
+
return *this;
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
``` cpp
|
| 131 |
+
constexpr iterator operator--(int) requires decrementable<W>;
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
*Effects:* Equivalent to:
|
| 135 |
+
|
| 136 |
+
``` cpp
|
| 137 |
+
auto tmp = *this;
|
| 138 |
+
--*this;
|
| 139 |
+
return tmp;
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
``` cpp
|
| 143 |
+
constexpr iterator& operator+=(difference_type n)
|
| 144 |
+
requires advanceable<W>;
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
*Effects:* Equivalent to:
|
| 148 |
+
|
| 149 |
+
``` cpp
|
| 150 |
+
if constexpr (is-integer-like<W> && !is-signed-integer-like<W>) {
|
| 151 |
+
if (n >= difference_type(0))
|
| 152 |
+
value_ += static_cast<W>(n);
|
| 153 |
+
else
|
| 154 |
+
value_ -= static_cast<W>(-n);
|
| 155 |
+
} else {
|
| 156 |
+
value_ += n;
|
| 157 |
+
}
|
| 158 |
+
return *this;
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
``` cpp
|
| 162 |
+
constexpr iterator& operator-=(difference_type n)
|
| 163 |
+
requires advanceable<W>;
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
*Effects:* Equivalent to:
|
| 167 |
+
|
| 168 |
+
``` cpp
|
| 169 |
+
if constexpr (is-integer-like<W> && !is-signed-integer-like<W>) {
|
| 170 |
+
if (n >= difference_type(0))
|
| 171 |
+
value_ -= static_cast<W>(n);
|
| 172 |
+
else
|
| 173 |
+
value_ += static_cast<W>(-n);
|
| 174 |
+
} else {
|
| 175 |
+
value_ -= n;
|
| 176 |
+
}
|
| 177 |
+
return *this;
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
``` cpp
|
| 181 |
+
constexpr W operator[](difference_type n) const
|
| 182 |
+
requires advanceable<W>;
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
*Effects:* Equivalent to: `return W(`*`value_`*` + n);`
|
| 186 |
+
|
| 187 |
+
``` cpp
|
| 188 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y)
|
| 189 |
+
requires equality_comparable<W>;
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
*Effects:* Equivalent to: `return x.`*`value_`*` == y.`*`value_`*`;`
|
| 193 |
+
|
| 194 |
+
``` cpp
|
| 195 |
+
friend constexpr bool operator<(const iterator& x, const iterator& y)
|
| 196 |
+
requires totally_ordered<W>;
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
*Effects:* Equivalent to: `return x.`*`value_`*` < y.`*`value_`*`;`
|
| 200 |
+
|
| 201 |
+
``` cpp
|
| 202 |
+
friend constexpr bool operator>(const iterator& x, const iterator& y)
|
| 203 |
+
requires totally_ordered<W>;
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
*Effects:* Equivalent to: `return y < x;`
|
| 207 |
+
|
| 208 |
+
``` cpp
|
| 209 |
+
friend constexpr bool operator<=(const iterator& x, const iterator& y)
|
| 210 |
+
requires totally_ordered<W>;
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
*Effects:* Equivalent to: `return !(y < x);`
|
| 214 |
+
|
| 215 |
+
``` cpp
|
| 216 |
+
friend constexpr bool operator>=(const iterator& x, const iterator& y)
|
| 217 |
+
requires totally_ordered<W>;
|
| 218 |
+
```
|
| 219 |
+
|
| 220 |
+
*Effects:* Equivalent to: `return !(x < y);`
|
| 221 |
+
|
| 222 |
+
``` cpp
|
| 223 |
+
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
|
| 224 |
+
requires totally_ordered<W> && three_way_comparable<W>;
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
*Effects:* Equivalent to: `return x.`*`value_`*` <=> y.`*`value_`*`;`
|
| 228 |
+
|
| 229 |
+
``` cpp
|
| 230 |
+
friend constexpr iterator operator+(iterator i, difference_type n)
|
| 231 |
+
requires advanceable<W>;
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
*Effects:* Equivalent to: `return i += n;`
|
| 235 |
+
|
| 236 |
+
``` cpp
|
| 237 |
+
friend constexpr iterator operator+(difference_type n, iterator i)
|
| 238 |
+
requires advanceable<W>;
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
*Effects:* Equivalent to: `return i + n;`
|
| 242 |
+
|
| 243 |
+
``` cpp
|
| 244 |
+
friend constexpr iterator operator-(iterator i, difference_type n)
|
| 245 |
+
requires advanceable<W>;
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
*Effects:* Equivalent to: `return i -= n;`
|
| 249 |
+
|
| 250 |
+
``` cpp
|
| 251 |
+
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
|
| 252 |
+
requires advanceable<W>;
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
*Effects:* Equivalent to:
|
| 256 |
+
|
| 257 |
+
``` cpp
|
| 258 |
+
using D = difference_type;
|
| 259 |
+
if constexpr (is-integer-like<W>) {
|
| 260 |
+
if constexpr (is-signed-integer-like<W>)
|
| 261 |
+
return D(D(x.value_) - D(y.value_));
|
| 262 |
+
else
|
| 263 |
+
return (y.value_ > x.value_)
|
| 264 |
+
? D(-D(y.value_ - x.value_))
|
| 265 |
+
: D(x.value_ - y.value_);
|
| 266 |
+
} else {
|
| 267 |
+
return x.value_ - y.value_;
|
| 268 |
+
}
|
| 269 |
+
```
|
| 270 |
+
|