From Jason Turner

[range.factories]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6gooxuly/{from.md → to.md} +26 -6
tmp/tmp6gooxuly/{from.md → to.md} RENAMED
@@ -81,10 +81,11 @@ namespace std::ranges {
81
 
82
  constexpr T* begin() noexcept;
83
  constexpr const T* begin() const noexcept;
84
  constexpr T* end() noexcept;
85
  constexpr const T* end() const noexcept;
 
86
  static constexpr size_t size() noexcept;
87
  constexpr T* data() noexcept;
88
  constexpr const T* data() const noexcept;
89
  };
90
 
@@ -126,10 +127,16 @@ constexpr T* end() noexcept;
126
  constexpr const T* end() const noexcept;
127
  ```
128
 
129
  *Effects:* Equivalent to: `return data() + 1;`
130
 
 
 
 
 
 
 
131
  ``` cpp
132
  static constexpr size_t size() noexcept;
133
  ```
134
 
135
  *Effects:* Equivalent to: `return 1;`
@@ -149,22 +156,28 @@ constexpr const T* data() const noexcept;
149
  an initial value.
150
 
151
  The name `views::iota` denotes a customization point object
152
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
153
  expressions `views::iota(E)` and `views::iota(E, F)` are
154
- expression-equivalent to `iota_view(E)` and `iota_view(E, F)`,
155
- respectively.
156
 
157
  [*Example 1*:
158
 
159
  ``` cpp
160
  for (int i : views::iota(1, 10))
161
  cout << i << ' '; // prints 1 2 3 4 5 6 7 8 9
162
  ```
163
 
164
  — *end example*]
165
 
 
 
 
 
 
 
166
  #### Class template `iota_view` <a id="range.iota.view">[[range.iota.view]]</a>
167
 
168
  ``` cpp
169
  namespace std::ranges {
170
  template<class I>
@@ -194,10 +207,11 @@ namespace std::ranges {
194
 
195
  constexpr iterator begin() const;
196
  constexpr auto end() const;
197
  constexpr iterator end() const requires same_as<W, Bound>;
198
 
 
199
  constexpr auto size() const requires see below;
200
  };
201
 
202
  template<class W, class Bound>
203
  requires (!is-integer-like<W> || !is-integer-like<Bound> ||
@@ -341,10 +355,16 @@ else
341
  constexpr iterator end() const requires same_as<W, Bound>;
342
  ```
343
 
344
  *Effects:* Equivalent to: `return `*`iterator`*`{`*`bound_`*`};`
345
 
 
 
 
 
 
 
346
  ``` cpp
347
  constexpr auto size() const requires see below;
348
  ```
349
 
350
  *Effects:* Equivalent to:
@@ -707,12 +727,12 @@ friend constexpr iter_difference_t<W> operator-(const sentinel& x, const iterato
707
  the same value.
708
 
709
  The name `views::repeat` denotes a customization point object
710
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
711
  expressions `views::repeat(E)` and `views::repeat(E, F)` are
712
- expression-equivalent to `repeat_view(E)` and `repeat_view(E, F)`,
713
- respectively.
714
 
715
  [*Example 1*:
716
 
717
  ``` cpp
718
  for (int i : views::repeat(17, 4))
@@ -759,12 +779,12 @@ namespace std::ranges {
759
  constexpr unreachable_sentinel_t end() const noexcept;
760
 
761
  constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
762
  };
763
 
764
- template<class T, class Bound>
765
- repeat_view(T, Bound) -> repeat_view<T, Bound>;
766
  }
767
  ```
768
 
769
  ``` cpp
770
  constexpr explicit repeat_view(const T& value, Bound bound = Bound())
 
81
 
82
  constexpr T* begin() noexcept;
83
  constexpr const T* begin() const noexcept;
84
  constexpr T* end() noexcept;
85
  constexpr const T* end() const noexcept;
86
+ static constexpr bool empty() noexcept;
87
  static constexpr size_t size() noexcept;
88
  constexpr T* data() noexcept;
89
  constexpr const T* data() const noexcept;
90
  };
91
 
 
127
  constexpr const T* end() const noexcept;
128
  ```
129
 
130
  *Effects:* Equivalent to: `return data() + 1;`
131
 
132
+ ``` cpp
133
+ static constexpr bool empty() noexcept;
134
+ ```
135
+
136
+ *Effects:* Equivalent to: `return false;`
137
+
138
  ``` cpp
139
  static constexpr size_t size() noexcept;
140
  ```
141
 
142
  *Effects:* Equivalent to: `return 1;`
 
156
  an initial value.
157
 
158
  The name `views::iota` denotes a customization point object
159
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
160
  expressions `views::iota(E)` and `views::iota(E, F)` are
161
+ expression-equivalent to `iota_view<decay_t<decltype((E))>>(E)` and
162
+ `iota_view(E, F)`, respectively.
163
 
164
  [*Example 1*:
165
 
166
  ``` cpp
167
  for (int i : views::iota(1, 10))
168
  cout << i << ' '; // prints 1 2 3 4 5 6 7 8 9
169
  ```
170
 
171
  — *end example*]
172
 
173
+ The name `views::indices` denotes a customization point object
174
+ [[customization.point.object]]. Given subexpression `E`, let `T` be
175
+ `remove_cvref_t<decltype((E))>`. `views::indices(E)` is
176
+ expression-equivalent to `views::iota(T(0), E)` if `is-integer-like<T>`
177
+ is `true`, and ill-formed otherwise.
178
+
179
  #### Class template `iota_view` <a id="range.iota.view">[[range.iota.view]]</a>
180
 
181
  ``` cpp
182
  namespace std::ranges {
183
  template<class I>
 
207
 
208
  constexpr iterator begin() const;
209
  constexpr auto end() const;
210
  constexpr iterator end() const requires same_as<W, Bound>;
211
 
212
+ constexpr bool empty() const;
213
  constexpr auto size() const requires see below;
214
  };
215
 
216
  template<class W, class Bound>
217
  requires (!is-integer-like<W> || !is-integer-like<Bound> ||
 
355
  constexpr iterator end() const requires same_as<W, Bound>;
356
  ```
357
 
358
  *Effects:* Equivalent to: `return `*`iterator`*`{`*`bound_`*`};`
359
 
360
+ ``` cpp
361
+ constexpr bool empty() const;
362
+ ```
363
+
364
+ *Effects:* Equivalent to: `return `*`value_`*` == `*`bound_`*`;`
365
+
366
  ``` cpp
367
  constexpr auto size() const requires see below;
368
  ```
369
 
370
  *Effects:* Equivalent to:
 
727
  the same value.
728
 
729
  The name `views::repeat` denotes a customization point object
730
  [[customization.point.object]]. Given subexpressions `E` and `F`, the
731
  expressions `views::repeat(E)` and `views::repeat(E, F)` are
732
+ expression-equivalent to `repeat_view<decay_t<decltype((E))>>(E)` and
733
+ `repeat_view(E, F)`, respectively.
734
 
735
  [*Example 1*:
736
 
737
  ``` cpp
738
  for (int i : views::repeat(17, 4))
 
779
  constexpr unreachable_sentinel_t end() const noexcept;
780
 
781
  constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
782
  };
783
 
784
+ template<class T, class Bound = unreachable_sentinel_t>
785
+ repeat_view(T, Bound = Bound()) -> repeat_view<T, Bound>;
786
  }
787
  ```
788
 
789
  ``` cpp
790
  constexpr explicit repeat_view(const T& value, Bound bound = Bound())