From Jason Turner

[range.iota.view]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpjdoz48j8/{from.md → to.md} +37 -17
tmp/tmpjdoz48j8/{from.md → to.md} RENAMED
@@ -1,32 +1,33 @@
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
 
@@ -54,11 +55,11 @@ Let `IOTA-DIFF-T(W)` be defined as follows:
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
  ```
@@ -78,11 +79,11 @@ only if
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);
@@ -116,30 +117,49 @@ value `n` of type `D`. `I` models `advanceable` only if
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
 
@@ -154,11 +174,11 @@ else
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
 
@@ -173,12 +193,12 @@ if constexpr (is-integer-like<W> && is-integer-like<Bound>)
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
 
 
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 exposition onlyconceptnc{decrementable} = see belownc; // exposition only
7
+
8
  template<class I>
9
+ concept exposition onlyconceptnc{advanceable} = see belownc; // exposition only
 
10
 
11
  template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
12
+ requires weakly-equality-comparable-with<W, Bound> && copyable<W>
13
  class iota_view : public view_interface<iota_view<W, Bound>> {
14
  private:
15
  // [range.iota.iterator], class iota_view::iterator
16
  struct iterator; // exposition only
17
+
18
  // [range.iota.sentinel], class iota_view::sentinel
19
  struct sentinel; // exposition only
20
+
21
  W value_ = W(); // exposition only
22
  Bound bound_ = Bound(); // exposition only
23
+
24
  public:
25
+ iota_view() requires default_initializable<W> = default;
26
  constexpr explicit iota_view(W value);
27
+ constexpr explicit iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
28
+ constexpr explicit iota_view(iterator first, see below last);
 
29
 
30
  constexpr iterator begin() const;
31
  constexpr auto end() const;
32
  constexpr iterator end() const requires same_as<W, Bound>;
33
 
 
55
 
56
  The exposition-only *decrementable* concept is equivalent to:
57
 
58
  ``` cpp
59
  template<class I>
60
+ concept decrementable = // exposition only
61
  incrementable<I> && requires(I i) {
62
  { --i } -> same_as<I&>;
63
  { i-- } -> same_as<I>;
64
  };
65
  ```
 
79
 
80
  The exposition-only *advanceable* concept is equivalent to:
81
 
82
  ``` cpp
83
  template<class I>
84
+ concept advanceable = // exposition only
85
  decrementable<I> && totally_ordered<I> &&
86
  requires(I i, const I j, const IOTA-DIFF-T(I) n) {
87
  { i += n } -> same_as<I&>;
88
  { i -= n } -> same_as<I&>;
89
  I(j + n);
 
117
  ``` cpp
118
  constexpr explicit iota_view(W value);
119
  ```
120
 
121
  *Preconditions:* `Bound` denotes `unreachable_sentinel_t` or `Bound()`
122
+ is reachable from `value`. When `W` and `Bound` model
123
+ `totally_ordered_with`, then `bool(value <= Bound())` is `true`.
124
 
125
  *Effects:* Initializes *value\_* with `value`.
126
 
127
  ``` cpp
128
+ constexpr explicit iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
129
  ```
130
 
131
  *Preconditions:* `Bound` denotes `unreachable_sentinel_t` or `bound` is
132
  reachable from `value`. When `W` and `Bound` model
133
  `totally_ordered_with`, then `bool(value <= bound)` is `true`.
134
 
135
  *Effects:* Initializes *value\_* with `value` and *bound\_* with
136
  `bound`.
137
 
138
+ ``` cpp
139
+ constexpr explicit iota_view(iterator first, see below last);
140
+ ```
141
+
142
+ *Effects:* Equivalent to:
143
+
144
+ - If `same_as<W, Bound>` is `true`,
145
+ `iota_view(first.`*`value_`*`, last.`*`value_`*`)`.
146
+ - Otherwise, if `Bound` denotes `unreachable_sentinel_t`,
147
+ `iota_view(first.`*`value_`*`, last)`.
148
+ - Otherwise, `iota_view(first.`*`value_`*`, last.`*`bound_`*`)`.
149
+
150
+ *Remarks:* The type of `last` is:
151
+
152
+ - If `same_as<W, Bound>` is `true`, *iterator*.
153
+ - Otherwise, if `Bound` denotes `unreachable_sentinel_t`, `Bound`.
154
+ - Otherwise, *sentinel*.
155
+
156
  ``` cpp
157
  constexpr iterator begin() const;
158
  ```
159
 
160
+ *Effects:* Equivalent to: `return `*`iterator`*`{`*`value_`*`};`
161
 
162
  ``` cpp
163
  constexpr auto end() const;
164
  ```
165
 
 
174
 
175
  ``` cpp
176
  constexpr iterator end() const requires same_as<W, Bound>;
177
  ```
178
 
179
+ *Effects:* Equivalent to: `return `*`iterator`*`{`*`bound_`*`};`
180
 
181
  ``` cpp
182
  constexpr auto size() const requires see below;
183
  ```
184
 
 
193
  : to-unsigned-like(bound_) - to-unsigned-like(value_);
194
  else
195
  return to-unsigned-like(bound_ - value_);
196
  ```
197
 
198
+ *Remarks:* The expression in the *requires-clause* is equivalent to:
199
 
200
  ``` cpp
201
+ (same_as<W, Bound> && advanceable<W>) || (is-integer-like<W> && is-integer-like<Bound>) ||
202
  sized_sentinel_for<Bound, W>
203
  ```
204