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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `iota_view` <a id="range.iota.view">[[range.iota.view]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<class I>
|
| 6 |
+
concept decrementable = // exposition only
|
| 7 |
+
see below;
|
| 8 |
+
template<class I>
|
| 9 |
+
concept advanceable = // exposition only
|
| 10 |
+
see below;
|
| 11 |
+
|
| 12 |
+
template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
|
| 13 |
+
requires weakly-equality-comparable-with<W, Bound> && semiregular<W>
|
| 14 |
+
class iota_view : public view_interface<iota_view<W, Bound>> {
|
| 15 |
+
private:
|
| 16 |
+
// [range.iota.iterator], class iota_view::iterator
|
| 17 |
+
struct iterator; // exposition only
|
| 18 |
+
// [range.iota.sentinel], class iota_view::sentinel
|
| 19 |
+
struct sentinel; // exposition only
|
| 20 |
+
W value_ = W(); // exposition only
|
| 21 |
+
Bound bound_ = Bound(); // exposition only
|
| 22 |
+
public:
|
| 23 |
+
iota_view() = default;
|
| 24 |
+
constexpr explicit iota_view(W value);
|
| 25 |
+
constexpr iota_view(type_identity_t<W> value,
|
| 26 |
+
type_identity_t<Bound> bound);
|
| 27 |
+
constexpr iota_view(iterator first, sentinel last) : iota_view(*first, last.bound_) {}
|
| 28 |
+
|
| 29 |
+
constexpr iterator begin() const;
|
| 30 |
+
constexpr auto end() const;
|
| 31 |
+
constexpr iterator end() const requires same_as<W, Bound>;
|
| 32 |
+
|
| 33 |
+
constexpr auto size() const requires see below;
|
| 34 |
+
};
|
| 35 |
+
|
| 36 |
+
template<class W, class Bound>
|
| 37 |
+
requires (!is-integer-like<W> || !is-integer-like<Bound> ||
|
| 38 |
+
(is-signed-integer-like<W> == is-signed-integer-like<Bound>))
|
| 39 |
+
iota_view(W, Bound) -> iota_view<W, Bound>;
|
| 40 |
+
}
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
Let `IOTA-DIFF-T(W)` be defined as follows:
|
| 44 |
+
|
| 45 |
+
- If `W` is not an integral type, or if it is an integral type and
|
| 46 |
+
`sizeof(iter_difference_t<W>)` is greater than `sizeof(W)`, then
|
| 47 |
+
`IOTA-DIFF-T(W)` denotes `iter_difference_t<W>`.
|
| 48 |
+
- Otherwise, `IOTA-DIFF-T(W)` is a signed integer type of width greater
|
| 49 |
+
than the width of `W` if such a type exists.
|
| 50 |
+
- Otherwise, `IOTA-DIFF-T(W)` is an unspecified signed-integer-like type
|
| 51 |
+
[[iterator.concept.winc]] of width not less than the width of `W`.
|
| 52 |
+
\[*Note 1*: It is unspecified whether this type satisfies
|
| 53 |
+
`weakly_incrementable`. — *end note*]
|
| 54 |
+
|
| 55 |
+
The exposition-only *decrementable* concept is equivalent to:
|
| 56 |
+
|
| 57 |
+
``` cpp
|
| 58 |
+
template<class I>
|
| 59 |
+
concept decrementable =
|
| 60 |
+
incrementable<I> && requires(I i) {
|
| 61 |
+
{ --i } -> same_as<I&>;
|
| 62 |
+
{ i-- } -> same_as<I>;
|
| 63 |
+
};
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
When an object is in the domain of both pre- and post-decrement, the
|
| 67 |
+
object is said to be *decrementable*.
|
| 68 |
+
|
| 69 |
+
Let `a` and `b` be equal objects of type `I`. `I` models `decrementable`
|
| 70 |
+
only if
|
| 71 |
+
|
| 72 |
+
- If `a` and `b` are decrementable, then the following are all true:
|
| 73 |
+
- `addressof(–a) == addressof(a)`
|
| 74 |
+
- `bool(a– == b)`
|
| 75 |
+
- `bool(((void)a–, a) == –b)`
|
| 76 |
+
- `bool(++(–a) == b)`.
|
| 77 |
+
- If `a` and `b` are incrementable, then `bool(–(++a) == b)`.
|
| 78 |
+
|
| 79 |
+
The exposition-only *advanceable* concept is equivalent to:
|
| 80 |
+
|
| 81 |
+
``` cpp
|
| 82 |
+
template<class I>
|
| 83 |
+
concept advanceable =
|
| 84 |
+
decrementable<I> && totally_ordered<I> &&
|
| 85 |
+
requires(I i, const I j, const IOTA-DIFF-T(I) n) {
|
| 86 |
+
{ i += n } -> same_as<I&>;
|
| 87 |
+
{ i -= n } -> same_as<I&>;
|
| 88 |
+
I(j + n);
|
| 89 |
+
I(n + j);
|
| 90 |
+
I(j - n);
|
| 91 |
+
{ j - j } -> convertible_to<IOTA-DIFF-T(I)>;
|
| 92 |
+
};
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
Let `D` be `IOTA-DIFF-T(I)`. Let `a` and `b` be objects of type `I` such
|
| 96 |
+
that `b` is reachable from `a` after `n` applications of `++a`, for some
|
| 97 |
+
value `n` of type `D`. `I` models `advanceable` only if
|
| 98 |
+
|
| 99 |
+
- `(a += n)` is equal to `b`.
|
| 100 |
+
- `addressof(a += n)` is equal to `addressof(a)`.
|
| 101 |
+
- `I(a + n)` is equal to `(a += n)`.
|
| 102 |
+
- For any two positive values `x` and `y` of type `D`, if
|
| 103 |
+
`I(a + D(x + y))` is well-defined, then `I(a + D(x + y))` is equal to
|
| 104 |
+
`I(I(a + x) + y)`.
|
| 105 |
+
- `I(a + D(0))` is equal to `a`.
|
| 106 |
+
- If `I(a + D(n - 1))` is well-defined, then `I(a + n)` is equal to
|
| 107 |
+
`[](I c) { return ++c; }(I(a + D(n - 1)))`.
|
| 108 |
+
- `(b += -n)` is equal to `a`.
|
| 109 |
+
- `(b -= n)` is equal to `a`.
|
| 110 |
+
- `addressof(b -= n)` is equal to `addressof(b)`.
|
| 111 |
+
- `I(b - n)` is equal to `(b -= n)`.
|
| 112 |
+
- `D(b - a)` is equal to `n`.
|
| 113 |
+
- `D(a - b)` is equal to `D(-n)`.
|
| 114 |
+
- `bool(a <= b)` is `true`.
|
| 115 |
+
|
| 116 |
+
``` cpp
|
| 117 |
+
constexpr explicit iota_view(W value);
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
*Preconditions:* `Bound` denotes `unreachable_sentinel_t` or `Bound()`
|
| 121 |
+
is reachable from `value`.
|
| 122 |
+
|
| 123 |
+
*Effects:* Initializes *value\_* with `value`.
|
| 124 |
+
|
| 125 |
+
``` cpp
|
| 126 |
+
constexpr iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
*Preconditions:* `Bound` denotes `unreachable_sentinel_t` or `bound` is
|
| 130 |
+
reachable from `value`. When `W` and `Bound` model
|
| 131 |
+
`totally_ordered_with`, then `bool(value <= bound)` is `true`.
|
| 132 |
+
|
| 133 |
+
*Effects:* Initializes *value\_* with `value` and *bound\_* with
|
| 134 |
+
`bound`.
|
| 135 |
+
|
| 136 |
+
``` cpp
|
| 137 |
+
constexpr iterator begin() const;
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
*Effects:* Equivalent to: `return iterator{`*`value_`*`};`
|
| 141 |
+
|
| 142 |
+
``` cpp
|
| 143 |
+
constexpr auto end() const;
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
*Effects:* Equivalent to:
|
| 147 |
+
|
| 148 |
+
``` cpp
|
| 149 |
+
if constexpr (same_as<Bound, unreachable_sentinel_t>)
|
| 150 |
+
return unreachable_sentinel;
|
| 151 |
+
else
|
| 152 |
+
return sentinel{bound_};
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
``` cpp
|
| 156 |
+
constexpr iterator end() const requires same_as<W, Bound>;
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
*Effects:* Equivalent to: `return iterator{bound_};`
|
| 160 |
+
|
| 161 |
+
``` cpp
|
| 162 |
+
constexpr auto size() const requires see below;
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
*Effects:* Equivalent to:
|
| 166 |
+
|
| 167 |
+
``` cpp
|
| 168 |
+
if constexpr (is-integer-like<W> && is-integer-like<Bound>)
|
| 169 |
+
return (value_ < 0)
|
| 170 |
+
? ((bound_ < 0)
|
| 171 |
+
? to-unsigned-like(-value_) - to-unsigned-like(-bound_)
|
| 172 |
+
: to-unsigned-like(bound_) + to-unsigned-like(-value_))
|
| 173 |
+
: to-unsigned-like(bound_) - to-unsigned-like(value_);
|
| 174 |
+
else
|
| 175 |
+
return to-unsigned-like(bound_ - value_);
|
| 176 |
+
```
|
| 177 |
+
|
| 178 |
+
*Remarks:* The expression in the *requires-clause* is equivalent to
|
| 179 |
+
|
| 180 |
+
``` cpp
|
| 181 |
+
(same_as<W, Bound> && advanceable<W>) || (integral<W> && integral<Bound>) ||
|
| 182 |
+
sized_sentinel_for<Bound, W>
|
| 183 |
+
```
|
| 184 |
+
|