tmp/tmph2xs4_nw/{from.md → to.md}
RENAMED
|
@@ -66,11 +66,11 @@ namespace std {
|
|
| 66 |
template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
|
| 67 |
requires sized_sentinel_for<S, I2>
|
| 68 |
friend constexpr iter_difference_t<I2> operator-(
|
| 69 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 70 |
|
| 71 |
-
friend constexpr
|
| 72 |
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
|
| 73 |
requires input_iterator<I>;
|
| 74 |
template<indirectly_swappable<I> I2, class S2>
|
| 75 |
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
|
| 76 |
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
|
|
@@ -85,30 +85,34 @@ namespace std {
|
|
| 85 |
};
|
| 86 |
|
| 87 |
template<input_iterator I, class S>
|
| 88 |
struct iterator_traits<common_iterator<I, S>> {
|
| 89 |
using iterator_concept = see below;
|
| 90 |
-
using iterator_category = see below;
|
| 91 |
using value_type = iter_value_t<I>;
|
| 92 |
using difference_type = iter_difference_t<I>;
|
| 93 |
using pointer = see below;
|
| 94 |
using reference = iter_reference_t<I>;
|
| 95 |
};
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
| 99 |
#### Associated types <a id="common.iter.types">[[common.iter.types]]</a>
|
| 100 |
|
| 101 |
-
The nested *typedef-name*
|
| 102 |
-
for `common_iterator<I, S>`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
- `iterator_concept` denotes `forward_iterator_tag` if `I` models
|
| 105 |
`forward_iterator`; otherwise it denotes `input_iterator_tag`.
|
| 106 |
-
- `iterator_category` denotes `forward_iterator_tag` if the
|
| 107 |
-
*qualified-id* `iterator_traits<I>::iterator_category` is valid and
|
| 108 |
-
denotes a type that models `derived_from<forward_iterator_tag>`;
|
| 109 |
-
otherwise it denotes `input_iterator_tag`.
|
| 110 |
- Let `a` denote an lvalue of type `const common_iterator<I, S>`. If the
|
| 111 |
expression `a.operator->()` is well-formed, then `pointer` denotes
|
| 112 |
`decltype(a.operator->())`. Otherwise, `pointer` denotes `void`.
|
| 113 |
|
| 114 |
#### Constructors and conversions <a id="common.iter.const">[[common.iter.const]]</a>
|
|
@@ -131,11 +135,11 @@ constexpr common_iterator(S s);
|
|
| 131 |
template<class I2, class S2>
|
| 132 |
requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
|
| 133 |
constexpr common_iterator(const common_iterator<I2, S2>& x);
|
| 134 |
```
|
| 135 |
|
| 136 |
-
|
| 137 |
|
| 138 |
*Effects:* Initializes `v_` as if by
|
| 139 |
`v_{in_place_index<`i`>, get<`i`>(x.v_)}`, where i is `x.v_.index()`.
|
| 140 |
|
| 141 |
``` cpp
|
|
@@ -143,30 +147,30 @@ template<class I2, class S2>
|
|
| 143 |
requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
|
| 144 |
assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
|
| 145 |
constexpr common_iterator& operator=(const common_iterator<I2, S2>& x);
|
| 146 |
```
|
| 147 |
|
| 148 |
-
|
| 149 |
|
| 150 |
*Effects:* Equivalent to:
|
| 151 |
|
| 152 |
- If `v_.index() == x.v_.index()`, then `get<`i`>(v_) = get<`i`>(x.v_)`.
|
| 153 |
- Otherwise, `v_.emplace<`i`>(get<`i`>(x.v_))`.
|
| 154 |
|
| 155 |
where i is `x.v_.index()`.
|
| 156 |
|
| 157 |
-
*Returns:* `*this`
|
| 158 |
|
| 159 |
#### Accessors <a id="common.iter.access">[[common.iter.access]]</a>
|
| 160 |
|
| 161 |
``` cpp
|
| 162 |
constexpr decltype(auto) operator*();
|
| 163 |
constexpr decltype(auto) operator*() const
|
| 164 |
requires dereferenceable<const I>;
|
| 165 |
```
|
| 166 |
|
| 167 |
-
|
| 168 |
|
| 169 |
*Effects:* Equivalent to: `return *get<I>(v_);`
|
| 170 |
|
| 171 |
``` cpp
|
| 172 |
constexpr auto operator->() const
|
|
@@ -180,11 +184,11 @@ indirectly_readable<const I> &&
|
|
| 180 |
(requires(const I& i) { i.operator->(); } ||
|
| 181 |
is_reference_v<iter_reference_t<I>> ||
|
| 182 |
constructible_from<iter_value_t<I>, iter_reference_t<I>>)
|
| 183 |
```
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
*Effects:*
|
| 188 |
|
| 189 |
- If `I` is a pointer type or if the expression
|
| 190 |
`get<I>(v_).operator->()` is well-formed, equivalent to:
|
|
@@ -213,21 +217,21 @@ indirectly_readable<const I> &&
|
|
| 213 |
|
| 214 |
``` cpp
|
| 215 |
constexpr common_iterator& operator++();
|
| 216 |
```
|
| 217 |
|
| 218 |
-
|
| 219 |
|
| 220 |
*Effects:* Equivalent to `++get<I>(v_)`.
|
| 221 |
|
| 222 |
*Returns:* `*this`.
|
| 223 |
|
| 224 |
``` cpp
|
| 225 |
constexpr decltype(auto) operator++(int);
|
| 226 |
```
|
| 227 |
|
| 228 |
-
|
| 229 |
|
| 230 |
*Effects:* If `I` models `forward_iterator`, equivalent to:
|
| 231 |
|
| 232 |
``` cpp
|
| 233 |
common_iterator tmp = *this;
|
|
@@ -278,12 +282,12 @@ template<class I2, sentinel_for<I> S2>
|
|
| 278 |
requires sentinel_for<S, I2>
|
| 279 |
friend constexpr bool operator==(
|
| 280 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 281 |
```
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
|
| 286 |
*Returns:* `true` if i` == `j, and otherwise
|
| 287 |
`get<`i`>(x.v_) == get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 288 |
`y.v_.index()`.
|
| 289 |
|
|
@@ -292,12 +296,12 @@ template<class I2, sentinel_for<I> S2>
|
|
| 292 |
requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
|
| 293 |
friend constexpr bool operator==(
|
| 294 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 295 |
```
|
| 296 |
|
| 297 |
-
|
| 298 |
-
|
| 299 |
|
| 300 |
*Returns:* `true` if i and j are each `1`, and otherwise
|
| 301 |
`get<`i`>(x.v_) == get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 302 |
`y.v_.index()`.
|
| 303 |
|
|
@@ -306,36 +310,36 @@ template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
|
|
| 306 |
requires sized_sentinel_for<S, I2>
|
| 307 |
friend constexpr iter_difference_t<I2> operator-(
|
| 308 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 309 |
```
|
| 310 |
|
| 311 |
-
|
| 312 |
-
|
| 313 |
|
| 314 |
*Returns:* `0` if i and j are each `1`, and otherwise
|
| 315 |
`get<`i`>(x.v_) - get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 316 |
`y.v_.index()`.
|
| 317 |
|
| 318 |
#### Customizations <a id="common.iter.cust">[[common.iter.cust]]</a>
|
| 319 |
|
| 320 |
``` cpp
|
| 321 |
-
friend constexpr
|
| 322 |
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
|
| 323 |
requires input_iterator<I>;
|
| 324 |
```
|
| 325 |
|
| 326 |
-
|
| 327 |
|
| 328 |
*Effects:* Equivalent to: `return ranges::iter_move(get<I>(i.v_));`
|
| 329 |
|
| 330 |
``` cpp
|
| 331 |
template<indirectly_swappable<I> I2, class S2>
|
| 332 |
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
|
| 333 |
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
|
| 334 |
```
|
| 335 |
|
| 336 |
-
|
| 337 |
-
`
|
| 338 |
|
| 339 |
*Effects:* Equivalent to
|
| 340 |
`ranges::iter_swap(get<I>(x.v_), get<I2>(y.v_))`.
|
| 341 |
|
|
|
|
| 66 |
template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
|
| 67 |
requires sized_sentinel_for<S, I2>
|
| 68 |
friend constexpr iter_difference_t<I2> operator-(
|
| 69 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 70 |
|
| 71 |
+
friend constexpr decltype(auto) iter_move(const common_iterator& i)
|
| 72 |
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
|
| 73 |
requires input_iterator<I>;
|
| 74 |
template<indirectly_swappable<I> I2, class S2>
|
| 75 |
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
|
| 76 |
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
|
|
|
|
| 85 |
};
|
| 86 |
|
| 87 |
template<input_iterator I, class S>
|
| 88 |
struct iterator_traits<common_iterator<I, S>> {
|
| 89 |
using iterator_concept = see below;
|
| 90 |
+
using iterator_category = see below; // not always present
|
| 91 |
using value_type = iter_value_t<I>;
|
| 92 |
using difference_type = iter_difference_t<I>;
|
| 93 |
using pointer = see below;
|
| 94 |
using reference = iter_reference_t<I>;
|
| 95 |
};
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
| 99 |
#### Associated types <a id="common.iter.types">[[common.iter.types]]</a>
|
| 100 |
|
| 101 |
+
The nested *typedef-name* `iterator_category` of the specialization of
|
| 102 |
+
`iterator_traits` for `common_iterator<I, S>` is defined if and only if
|
| 103 |
+
`iter_difference_t<I>` is an integral type. In that case,
|
| 104 |
+
`iterator_category` denotes `forward_iterator_tag` if the *qualified-id*
|
| 105 |
+
`iterator_traits<I>::iterator_category` is valid and denotes a type that
|
| 106 |
+
models `derived_from<forward_iterator_tag>`; otherwise it denotes
|
| 107 |
+
`input_iterator_tag`.
|
| 108 |
+
|
| 109 |
+
The remaining nested *typedef-name*s of the specialization of
|
| 110 |
+
`iterator_traits` for `common_iterator<I, S>` are defined as follows:
|
| 111 |
|
| 112 |
- `iterator_concept` denotes `forward_iterator_tag` if `I` models
|
| 113 |
`forward_iterator`; otherwise it denotes `input_iterator_tag`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
- Let `a` denote an lvalue of type `const common_iterator<I, S>`. If the
|
| 115 |
expression `a.operator->()` is well-formed, then `pointer` denotes
|
| 116 |
`decltype(a.operator->())`. Otherwise, `pointer` denotes `void`.
|
| 117 |
|
| 118 |
#### Constructors and conversions <a id="common.iter.const">[[common.iter.const]]</a>
|
|
|
|
| 135 |
template<class I2, class S2>
|
| 136 |
requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
|
| 137 |
constexpr common_iterator(const common_iterator<I2, S2>& x);
|
| 138 |
```
|
| 139 |
|
| 140 |
+
`x.v_.valueless_by_exception()` is `false`.
|
| 141 |
|
| 142 |
*Effects:* Initializes `v_` as if by
|
| 143 |
`v_{in_place_index<`i`>, get<`i`>(x.v_)}`, where i is `x.v_.index()`.
|
| 144 |
|
| 145 |
``` cpp
|
|
|
|
| 147 |
requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
|
| 148 |
assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
|
| 149 |
constexpr common_iterator& operator=(const common_iterator<I2, S2>& x);
|
| 150 |
```
|
| 151 |
|
| 152 |
+
`x.v_.valueless_by_exception()` is `false`.
|
| 153 |
|
| 154 |
*Effects:* Equivalent to:
|
| 155 |
|
| 156 |
- If `v_.index() == x.v_.index()`, then `get<`i`>(v_) = get<`i`>(x.v_)`.
|
| 157 |
- Otherwise, `v_.emplace<`i`>(get<`i`>(x.v_))`.
|
| 158 |
|
| 159 |
where i is `x.v_.index()`.
|
| 160 |
|
| 161 |
+
*Returns:* `*this`.
|
| 162 |
|
| 163 |
#### Accessors <a id="common.iter.access">[[common.iter.access]]</a>
|
| 164 |
|
| 165 |
``` cpp
|
| 166 |
constexpr decltype(auto) operator*();
|
| 167 |
constexpr decltype(auto) operator*() const
|
| 168 |
requires dereferenceable<const I>;
|
| 169 |
```
|
| 170 |
|
| 171 |
+
`holds_alternative<I>(v_)` is `true`.
|
| 172 |
|
| 173 |
*Effects:* Equivalent to: `return *get<I>(v_);`
|
| 174 |
|
| 175 |
``` cpp
|
| 176 |
constexpr auto operator->() const
|
|
|
|
| 184 |
(requires(const I& i) { i.operator->(); } ||
|
| 185 |
is_reference_v<iter_reference_t<I>> ||
|
| 186 |
constructible_from<iter_value_t<I>, iter_reference_t<I>>)
|
| 187 |
```
|
| 188 |
|
| 189 |
+
`holds_alternative<I>(v_)` is `true`.
|
| 190 |
|
| 191 |
*Effects:*
|
| 192 |
|
| 193 |
- If `I` is a pointer type or if the expression
|
| 194 |
`get<I>(v_).operator->()` is well-formed, equivalent to:
|
|
|
|
| 217 |
|
| 218 |
``` cpp
|
| 219 |
constexpr common_iterator& operator++();
|
| 220 |
```
|
| 221 |
|
| 222 |
+
`holds_alternative<I>(v_)` is `true`.
|
| 223 |
|
| 224 |
*Effects:* Equivalent to `++get<I>(v_)`.
|
| 225 |
|
| 226 |
*Returns:* `*this`.
|
| 227 |
|
| 228 |
``` cpp
|
| 229 |
constexpr decltype(auto) operator++(int);
|
| 230 |
```
|
| 231 |
|
| 232 |
+
`holds_alternative<I>(v_)` is `true`.
|
| 233 |
|
| 234 |
*Effects:* If `I` models `forward_iterator`, equivalent to:
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
common_iterator tmp = *this;
|
|
|
|
| 282 |
requires sentinel_for<S, I2>
|
| 283 |
friend constexpr bool operator==(
|
| 284 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 285 |
```
|
| 286 |
|
| 287 |
+
`x.v_.valueless_by_exception()` and `y.v_.valueless_by_exception()` are
|
| 288 |
+
each `false`.
|
| 289 |
|
| 290 |
*Returns:* `true` if i` == `j, and otherwise
|
| 291 |
`get<`i`>(x.v_) == get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 292 |
`y.v_.index()`.
|
| 293 |
|
|
|
|
| 296 |
requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
|
| 297 |
friend constexpr bool operator==(
|
| 298 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 299 |
```
|
| 300 |
|
| 301 |
+
`x.v_.valueless_by_exception()` and `y.v_.valueless_by_exception()` are
|
| 302 |
+
each `false`.
|
| 303 |
|
| 304 |
*Returns:* `true` if i and j are each `1`, and otherwise
|
| 305 |
`get<`i`>(x.v_) == get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 306 |
`y.v_.index()`.
|
| 307 |
|
|
|
|
| 310 |
requires sized_sentinel_for<S, I2>
|
| 311 |
friend constexpr iter_difference_t<I2> operator-(
|
| 312 |
const common_iterator& x, const common_iterator<I2, S2>& y);
|
| 313 |
```
|
| 314 |
|
| 315 |
+
`x.v_.valueless_by_exception()` and `y.v_.valueless_by_exception()` are
|
| 316 |
+
each `false`.
|
| 317 |
|
| 318 |
*Returns:* `0` if i and j are each `1`, and otherwise
|
| 319 |
`get<`i`>(x.v_) - get<`j`>(y.v_)`, where i is `x.v_.index()` and j is
|
| 320 |
`y.v_.index()`.
|
| 321 |
|
| 322 |
#### Customizations <a id="common.iter.cust">[[common.iter.cust]]</a>
|
| 323 |
|
| 324 |
``` cpp
|
| 325 |
+
friend constexpr decltype(auto) iter_move(const common_iterator& i)
|
| 326 |
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
|
| 327 |
requires input_iterator<I>;
|
| 328 |
```
|
| 329 |
|
| 330 |
+
`holds_alternative<I>(i.v_)` is `true`.
|
| 331 |
|
| 332 |
*Effects:* Equivalent to: `return ranges::iter_move(get<I>(i.v_));`
|
| 333 |
|
| 334 |
``` cpp
|
| 335 |
template<indirectly_swappable<I> I2, class S2>
|
| 336 |
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
|
| 337 |
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
|
| 338 |
```
|
| 339 |
|
| 340 |
+
`holds_alternative<I>(x.v_)` and `holds_alternative<I2>(y.v_)` are each
|
| 341 |
+
`true`.
|
| 342 |
|
| 343 |
*Effects:* Equivalent to
|
| 344 |
`ranges::iter_swap(get<I>(x.v_), get<I2>(y.v_))`.
|
| 345 |
|