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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `adjacent_view::iterator` <a id="range.adjacent.iterator">[[range.adjacent.iterator]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<forward_range V, size_t N>
|
| 6 |
+
requires view<V> && (N > 0)
|
| 7 |
+
template<bool Const>
|
| 8 |
+
class adjacent_view<V, N>::iterator {
|
| 9 |
+
using Base = maybe-const<Const, V>; // exposition only
|
| 10 |
+
array<iterator_t<Base>, N> current_ = array<iterator_t<Base>, N>(); // exposition only
|
| 11 |
+
constexpr iterator(iterator_t<Base> first, sentinel_t<Base> last); // exposition only
|
| 12 |
+
constexpr iterator(as-sentinel, iterator_t<Base> first, iterator_t<Base> last);
|
| 13 |
+
// exposition only
|
| 14 |
+
public:
|
| 15 |
+
using iterator_category = input_iterator_tag;
|
| 16 |
+
using iterator_concept = see below;
|
| 17 |
+
using value_type = tuple<REPEAT(range_value_t<Base>, N)...>;
|
| 18 |
+
using difference_type = range_difference_t<Base>;
|
| 19 |
+
|
| 20 |
+
iterator() = default;
|
| 21 |
+
constexpr iterator(iterator<!Const> i)
|
| 22 |
+
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
|
| 23 |
+
|
| 24 |
+
constexpr auto operator*() const;
|
| 25 |
+
constexpr iterator& operator++();
|
| 26 |
+
constexpr iterator operator++(int);
|
| 27 |
+
|
| 28 |
+
constexpr iterator& operator--() requires bidirectional_range<Base>;
|
| 29 |
+
constexpr iterator operator--(int) requires bidirectional_range<Base>;
|
| 30 |
+
|
| 31 |
+
constexpr iterator& operator+=(difference_type x)
|
| 32 |
+
requires random_access_range<Base>;
|
| 33 |
+
constexpr iterator& operator-=(difference_type x)
|
| 34 |
+
requires random_access_range<Base>;
|
| 35 |
+
|
| 36 |
+
constexpr auto operator[](difference_type n) const
|
| 37 |
+
requires random_access_range<Base>;
|
| 38 |
+
|
| 39 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y);
|
| 40 |
+
friend constexpr bool operator<(const iterator& x, const iterator& y)
|
| 41 |
+
requires random_access_range<Base>;
|
| 42 |
+
friend constexpr bool operator>(const iterator& x, const iterator& y)
|
| 43 |
+
requires random_access_range<Base>;
|
| 44 |
+
friend constexpr bool operator<=(const iterator& x, const iterator& y)
|
| 45 |
+
requires random_access_range<Base>;
|
| 46 |
+
friend constexpr bool operator>=(const iterator& x, const iterator& y)
|
| 47 |
+
requires random_access_range<Base>;
|
| 48 |
+
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
|
| 49 |
+
requires random_access_range<Base> &&
|
| 50 |
+
three_way_comparable<iterator_t<Base>>;
|
| 51 |
+
|
| 52 |
+
friend constexpr iterator operator+(const iterator& i, difference_type n)
|
| 53 |
+
requires random_access_range<Base>;
|
| 54 |
+
friend constexpr iterator operator+(difference_type n, const iterator& i)
|
| 55 |
+
requires random_access_range<Base>;
|
| 56 |
+
friend constexpr iterator operator-(const iterator& i, difference_type n)
|
| 57 |
+
requires random_access_range<Base>;
|
| 58 |
+
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
|
| 59 |
+
requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
|
| 60 |
+
|
| 61 |
+
friend constexpr auto iter_move(const iterator& i) noexcept(see below);
|
| 62 |
+
friend constexpr void iter_swap(const iterator& l, const iterator& r) noexcept(see below)
|
| 63 |
+
requires indirectly_swappable<iterator_t<Base>>;
|
| 64 |
+
};
|
| 65 |
+
}
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
`iterator::iterator_concept` is defined as follows:
|
| 69 |
+
|
| 70 |
+
- If *`Base`* models `random_access_range`, then `iterator_concept`
|
| 71 |
+
denotes `random_access_iterator_tag`.
|
| 72 |
+
- Otherwise, if *`Base`* models `bidirectional_range`, then
|
| 73 |
+
`iterator_concept` denotes `bidirectional_iterator_tag`.
|
| 74 |
+
- Otherwise, `iterator_concept` denotes `forward_iterator_tag`.
|
| 75 |
+
|
| 76 |
+
If the invocation of any non-const member function of *`iterator`* exits
|
| 77 |
+
via an exception, the *`iterator`* acquires a singular value.
|
| 78 |
+
|
| 79 |
+
``` cpp
|
| 80 |
+
constexpr iterator(iterator_t<Base> first, sentinel_t<Base> last);
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
*Ensures:* *`current_`*`[0] == first` is `true`, and for every integer
|
| 84 |
+
1 ≤ i < `N`,
|
| 85 |
+
*`current_`*`[`i`] == ranges::next(`*`current_`*`[`i`-1], 1, last)` is
|
| 86 |
+
`true`.
|
| 87 |
+
|
| 88 |
+
``` cpp
|
| 89 |
+
constexpr iterator(as-sentinel, iterator_t<Base> first, iterator_t<Base> last);
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
*Ensures:* If *Base* does not model `bidirectional_range`, each element
|
| 93 |
+
of *current\_* is equal to *last*. Otherwise,
|
| 94 |
+
*`current_`*`[N-1] == last` is `true`, and for every integer
|
| 95 |
+
0 ≤ i < (`N` - 1),
|
| 96 |
+
*`current_`*`[`i`] == ranges::prev(`*`current_`*`[`i`+1], 1, first)` is
|
| 97 |
+
`true`.
|
| 98 |
+
|
| 99 |
+
``` cpp
|
| 100 |
+
constexpr iterator(iterator<!Const> i)
|
| 101 |
+
requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
*Effects:* Initializes each element of *current\_* with the
|
| 105 |
+
corresponding element of `i.`*`current_`* as an xvalue.
|
| 106 |
+
|
| 107 |
+
``` cpp
|
| 108 |
+
constexpr auto operator*() const;
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
*Effects:* Equivalent to:
|
| 112 |
+
|
| 113 |
+
``` cpp
|
| 114 |
+
return tuple-transform([](auto& i) -> decltype(auto) { return *i; }, current_);
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
``` cpp
|
| 118 |
+
constexpr iterator& operator++();
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
*Preconditions:* *`current_`*`.back()` is incrementable.
|
| 122 |
+
|
| 123 |
+
*Ensures:* Each element of *current\_* is equal to `ranges::next(i)`,
|
| 124 |
+
where `i` is the value of that element before the call.
|
| 125 |
+
|
| 126 |
+
*Returns:* `*this`.
|
| 127 |
+
|
| 128 |
+
``` cpp
|
| 129 |
+
constexpr iterator operator++(int);
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
*Effects:* Equivalent to:
|
| 133 |
+
|
| 134 |
+
``` cpp
|
| 135 |
+
auto tmp = *this;
|
| 136 |
+
++*this;
|
| 137 |
+
return tmp;
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
``` cpp
|
| 141 |
+
constexpr iterator& operator--() requires bidirectional_range<Base>;
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
*Preconditions:* *`current_`*`.front()` is decrementable.
|
| 145 |
+
|
| 146 |
+
*Ensures:* Each element of *current\_* is equal to `ranges::prev(i)`,
|
| 147 |
+
where `i` is the value of that element before the call.
|
| 148 |
+
|
| 149 |
+
*Returns:* `*this`.
|
| 150 |
+
|
| 151 |
+
``` cpp
|
| 152 |
+
constexpr iterator operator--(int) requires bidirectional_range<Base>;
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
*Effects:* Equivalent to:
|
| 156 |
+
|
| 157 |
+
``` cpp
|
| 158 |
+
auto tmp = *this;
|
| 159 |
+
--*this;
|
| 160 |
+
return tmp;
|
| 161 |
+
```
|
| 162 |
+
|
| 163 |
+
``` cpp
|
| 164 |
+
constexpr iterator& operator+=(difference_type x)
|
| 165 |
+
requires random_access_range<Base>;
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
*Preconditions:* *`current_`*`.back() + x` has well-defined behavior.
|
| 169 |
+
|
| 170 |
+
*Ensures:* Each element of *current\_* is equal to `i + x`, where `i` is
|
| 171 |
+
the value of that element before the call.
|
| 172 |
+
|
| 173 |
+
*Returns:* `*this`.
|
| 174 |
+
|
| 175 |
+
``` cpp
|
| 176 |
+
constexpr iterator& operator-=(difference_type x)
|
| 177 |
+
requires random_access_range<Base>;
|
| 178 |
+
```
|
| 179 |
+
|
| 180 |
+
*Preconditions:* *`current_`*`.front() - x` has well-defined behavior.
|
| 181 |
+
|
| 182 |
+
*Ensures:* Each element of *current\_* is equal to `i - x`, where `i` is
|
| 183 |
+
the value of that element before the call.
|
| 184 |
+
|
| 185 |
+
*Returns:* `*this`.
|
| 186 |
+
|
| 187 |
+
``` cpp
|
| 188 |
+
constexpr auto operator[](difference_type n) const
|
| 189 |
+
requires random_access_range<Base>;
|
| 190 |
+
```
|
| 191 |
+
|
| 192 |
+
*Effects:* Equivalent to:
|
| 193 |
+
|
| 194 |
+
``` cpp
|
| 195 |
+
return tuple-transform([&](auto& i) -> decltype(auto) { return i[n]; }, current_);
|
| 196 |
+
```
|
| 197 |
+
|
| 198 |
+
``` cpp
|
| 199 |
+
friend constexpr bool operator==(const iterator& x, const iterator& y);
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
*Returns:* `x.`*`current_`*`.back() == y.`*`current_`*`.back()`.
|
| 203 |
+
|
| 204 |
+
``` cpp
|
| 205 |
+
friend constexpr bool operator<(const iterator& x, const iterator& y)
|
| 206 |
+
requires random_access_range<Base>;
|
| 207 |
+
```
|
| 208 |
+
|
| 209 |
+
*Returns:* `x.`*`current_`*`.back() < y.`*`current_`*`.back()`.
|
| 210 |
+
|
| 211 |
+
``` cpp
|
| 212 |
+
friend constexpr bool operator>(const iterator& x, const iterator& y)
|
| 213 |
+
requires random_access_range<Base>;
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
*Effects:* Equivalent to: `return y < x;`
|
| 217 |
+
|
| 218 |
+
``` cpp
|
| 219 |
+
friend constexpr bool operator<=(const iterator& x, const iterator& y)
|
| 220 |
+
requires random_access_range<Base>;
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
*Effects:* Equivalent to: `return !(y < x);`
|
| 224 |
+
|
| 225 |
+
``` cpp
|
| 226 |
+
friend constexpr bool operator>=(const iterator& x, const iterator& y)
|
| 227 |
+
requires random_access_range<Base>;
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
*Effects:* Equivalent to: `return !(x < y);`
|
| 231 |
+
|
| 232 |
+
``` cpp
|
| 233 |
+
friend constexpr auto operator<=>(const iterator& x, const iterator& y)
|
| 234 |
+
requires random_access_range<Base> &&
|
| 235 |
+
three_way_comparable<iterator_t<Base>>;
|
| 236 |
+
```
|
| 237 |
+
|
| 238 |
+
*Returns:* `x.`*`current_`*`.back() <=> y.`*`current_`*`.back()`.
|
| 239 |
+
|
| 240 |
+
``` cpp
|
| 241 |
+
friend constexpr iterator operator+(const iterator& i, difference_type n)
|
| 242 |
+
requires random_access_range<Base>;
|
| 243 |
+
friend constexpr iterator operator+(difference_type n, const iterator& i)
|
| 244 |
+
requires random_access_range<Base>;
|
| 245 |
+
```
|
| 246 |
+
|
| 247 |
+
*Effects:* Equivalent to:
|
| 248 |
+
|
| 249 |
+
``` cpp
|
| 250 |
+
auto r = i;
|
| 251 |
+
r += n;
|
| 252 |
+
return r;
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
``` cpp
|
| 256 |
+
friend constexpr iterator operator-(const iterator& i, difference_type n)
|
| 257 |
+
requires random_access_range<Base>;
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
*Effects:* Equivalent to:
|
| 261 |
+
|
| 262 |
+
``` cpp
|
| 263 |
+
auto r = i;
|
| 264 |
+
r -= n;
|
| 265 |
+
return r;
|
| 266 |
+
```
|
| 267 |
+
|
| 268 |
+
``` cpp
|
| 269 |
+
friend constexpr difference_type operator-(const iterator& x, const iterator& y)
|
| 270 |
+
requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
|
| 271 |
+
```
|
| 272 |
+
|
| 273 |
+
*Effects:* Equivalent to:
|
| 274 |
+
`return x.`*`current_`*`.back() - y.`*`current_`*`.back();`
|
| 275 |
+
|
| 276 |
+
``` cpp
|
| 277 |
+
friend constexpr auto iter_move(const iterator& i) noexcept(see below);
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
*Effects:* Equivalent to:
|
| 281 |
+
`return `*`tuple-transform`*`(ranges::iter_move, i.`*`current_`*`);`
|
| 282 |
+
|
| 283 |
+
*Remarks:* The exception specification is equivalent to:
|
| 284 |
+
|
| 285 |
+
``` cpp
|
| 286 |
+
noexcept(ranges::iter_move(declval<const iterator_t<Base>&>())) &&
|
| 287 |
+
is_nothrow_move_constructible_v<range_rvalue_reference_t<Base>>
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
``` cpp
|
| 291 |
+
friend constexpr void iter_swap(const iterator& l, const iterator& r) noexcept(see below)
|
| 292 |
+
requires indirectly_swappable<iterator_t<Base>>;
|
| 293 |
+
```
|
| 294 |
+
|
| 295 |
+
*Preconditions:* None of the iterators in `l.`*`current_`* is equal to
|
| 296 |
+
an iterator in `r.`*`current_`*.
|
| 297 |
+
|
| 298 |
+
*Effects:* For every integer 0 ≤ i < `N`, performs
|
| 299 |
+
`ranges::iter_swap(l.`*`current_`*`[`i`], r.`*`current_`*`[`i`])`.
|
| 300 |
+
|
| 301 |
+
*Remarks:* The exception specification is equivalent to:
|
| 302 |
+
|
| 303 |
+
``` cpp
|
| 304 |
+
noexcept(ranges::iter_swap(declval<iterator_t<Base>>(), declval<iterator_t<Base>>()))
|
| 305 |
+
```
|
| 306 |
+
|