From Jason Turner

[ranges.syn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpt0qbqj9n/{from.md → to.md} +299 -0
tmp/tmpt0qbqj9n/{from.md → to.md} RENAMED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Header `<ranges>` synopsis <a id="ranges.syn">[[ranges.syn]]</a>
2
+
3
+ ``` cpp
4
+ #include <compare> // see [compare.syn]
5
+ #include <initializer_list> // see [initializer.list.syn]
6
+ #include <iterator> // see [iterator.synopsis]
7
+
8
+ namespace std::ranges {
9
+ inline namespace unspecified {
10
+ // [range.access], range access
11
+ inline constexpr unspecified begin = unspecified;
12
+ inline constexpr unspecified end = unspecified;
13
+ inline constexpr unspecified cbegin = unspecified;
14
+ inline constexpr unspecified cend = unspecified;
15
+ inline constexpr unspecified rbegin = unspecified;
16
+ inline constexpr unspecified rend = unspecified;
17
+ inline constexpr unspecified crbegin = unspecified;
18
+ inline constexpr unspecified crend = unspecified;
19
+
20
+ inline constexpr unspecified size = unspecified;
21
+ inline constexpr unspecified ssize = unspecified;
22
+ inline constexpr unspecified empty = unspecified;
23
+ inline constexpr unspecified data = unspecified;
24
+ inline constexpr unspecified cdata = unspecified;
25
+ }
26
+
27
+ // [range.range], ranges
28
+ template<class T>
29
+ concept range = see below;
30
+
31
+ template<class T>
32
+ inline constexpr bool enable_borrowed_range = false;
33
+
34
+ template<class T>
35
+ concept borrowed_range = see below;
36
+
37
+ template<class T>
38
+ using iterator_t = decltype(ranges::begin(declval<T&>()));
39
+ template<range R>
40
+ using sentinel_t = decltype(ranges::end(declval<R&>()));
41
+ template<range R>
42
+ using range_difference_t = iter_difference_t<iterator_t<R>>;
43
+ template<sized_range R>
44
+ using range_size_t = decltype(ranges::size(declval<R&>()));
45
+ template<range R>
46
+ using range_value_t = iter_value_t<iterator_t<R>>;
47
+ template<range R>
48
+ using range_reference_t = iter_reference_t<iterator_t<R>>;
49
+ template<range R>
50
+ using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
51
+
52
+ // [range.sized], sized ranges
53
+ template<class>
54
+ inline constexpr bool disable_sized_range = false;
55
+
56
+ template<class T>
57
+ concept sized_range = see below;
58
+
59
+ // [range.view], views
60
+ template<class T>
61
+ inline constexpr bool enable_view = see below;
62
+
63
+ struct view_base { };
64
+
65
+ template<class T>
66
+ concept view = see below;
67
+
68
+ // [range.refinements], other range refinements
69
+ template<class R, class T>
70
+ concept output_range = see below;
71
+
72
+ template<class T>
73
+ concept input_range = see below;
74
+
75
+ template<class T>
76
+ concept forward_range = see below;
77
+
78
+ template<class T>
79
+ concept bidirectional_range = see below;
80
+
81
+ template<class T>
82
+ concept random_access_range = see below;
83
+
84
+ template<class T>
85
+ concept contiguous_range = see below;
86
+
87
+ template<class T>
88
+ concept common_range = see below;
89
+
90
+ template<class T>
91
+ concept viewable_range = see below;
92
+
93
+ // [view.interface], class template view_interface
94
+ template<class D>
95
+ requires is_class_v<D> && same_as<D, remove_cv_t<D>>
96
+ class view_interface;
97
+
98
+ // [range.subrange], sub-ranges
99
+ enum class subrange_kind : bool { unsized, sized };
100
+
101
+ template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below>
102
+ requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
103
+ class subrange;
104
+
105
+ template<input_or_output_iterator I, sentinel_for<I> S, subrange_kind K>
106
+ inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
107
+
108
+ // [range.dangling], dangling iterator handling
109
+ struct dangling;
110
+
111
+ template<range R>
112
+ using borrowed_iterator_t = conditional_t<borrowed_range<R>, iterator_t<R>, dangling>;
113
+
114
+ template<range R>
115
+ using borrowed_subrange_t =
116
+ conditional_t<borrowed_range<R>, subrange<iterator_t<R>>, dangling>;
117
+
118
+ // [range.empty], empty view
119
+ template<class T>
120
+ requires is_object_v<T>
121
+ class empty_view;
122
+
123
+ template<class T>
124
+ inline constexpr bool enable_borrowed_range<empty_view<T>> = true;
125
+
126
+ namespace views {
127
+ template<class T>
128
+ inline constexpr empty_view<T> empty{};
129
+ }
130
+
131
+ // [range.single], single view
132
+ template<copy_constructible T>
133
+ requires is_object_v<T>
134
+ class single_view;
135
+
136
+ namespace views { inline constexpr unspecified single = unspecified; }
137
+
138
+ // [range.iota], iota view
139
+ template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
140
+ requires weakly-equality-comparable-with<W, Bound>
141
+ class iota_view;
142
+
143
+ template<weakly_incrementable W, semiregular Bound>
144
+ inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
145
+
146
+ namespace views { inline constexpr unspecified iota = unspecified; }
147
+
148
+ // [range.istream], istream view
149
+ template<movable Val, class CharT, class Traits = char_traits<CharT>>
150
+ requires see below
151
+ class basic_istream_view;
152
+ template<class Val, class CharT, class Traits>
153
+ basic_istream_view<Val, CharT, Traits> istream_view(basic_istream<CharT, Traits>& s);
154
+
155
+ // [range.all], all view
156
+ namespace views {
157
+ inline constexpr unspecified all = unspecified;
158
+
159
+ template<viewable_range R>
160
+ using all_t = decltype(all(declval<R>()));
161
+ }
162
+
163
+ template<range R>
164
+ requires is_object_v<R>
165
+ class ref_view;
166
+
167
+ template<class T>
168
+ inline constexpr bool enable_borrowed_range<ref_view<T>> = true;
169
+
170
+ // [range.filter], filter view
171
+ template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
172
+ requires view<V> && is_object_v<Pred>
173
+ class filter_view;
174
+
175
+ namespace views { inline constexpr unspecified filter = unspecified; }
176
+
177
+ // [range.transform], transform view
178
+ template<input_range V, copy_constructible F>
179
+ requires view<V> && is_object_v<F> &&
180
+ regular_invocable<F&, range_reference_t<V>>
181
+ class transform_view;
182
+
183
+ namespace views { inline constexpr unspecified transform = unspecified; }
184
+
185
+ // [range.take], take view
186
+ template<view> class take_view;
187
+
188
+ namespace views { inline constexpr unspecified take = unspecified; }
189
+
190
+ // [range.take.while], take while view
191
+ template<view V, class Pred>
192
+ requires input_range<V> && is_object_v<Pred> &&
193
+ indirect_unary_predicate<const Pred, iterator_t<V>>
194
+ class take_while_view;
195
+
196
+ namespace views { inline constexpr unspecified take_while = unspecified; }
197
+
198
+ // [range.drop], drop view
199
+ template<view V>
200
+ class drop_view;
201
+
202
+ namespace views { inline constexpr unspecified drop = unspecified; }
203
+
204
+ // [range.drop.while], drop while view
205
+ template<view V, class Pred>
206
+ requires input_range<V> && is_object_v<Pred> &&
207
+ indirect_unary_predicate<const Pred, iterator_t<V>>
208
+ class drop_while_view;
209
+
210
+ namespace views { inline constexpr unspecified drop_while = unspecified; }
211
+
212
+ // [range.join], join view
213
+ template<input_range V>
214
+ requires view<V> && input_range<range_reference_t<V>> &&
215
+ (is_reference_v<range_reference_t<V>> ||
216
+ view<range_value_t<V>>)
217
+ class join_view;
218
+
219
+ namespace views { inline constexpr unspecified join = unspecified; }
220
+
221
+ // [range.split], split view
222
+ template<class R>
223
+ concept tiny-range = see below; // exposition only
224
+
225
+ template<input_range V, forward_range Pattern>
226
+ requires view<V> && view<Pattern> &&
227
+ indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
228
+ (forward_range<V> || tiny-range<Pattern>)
229
+ class split_view;
230
+
231
+ namespace views { inline constexpr unspecified split = unspecified; }
232
+
233
+ // [range.counted], counted view
234
+ namespace views { inline constexpr unspecified counted = unspecified; }
235
+
236
+ // [range.common], common view
237
+ template<view V>
238
+ requires (!common_range<V> && copyable<iterator_t<V>>)
239
+ class common_view;
240
+
241
+ namespace views { inline constexpr unspecified common = unspecified; }
242
+
243
+ // [range.reverse], reverse view
244
+ template<view V>
245
+ requires bidirectional_range<V>
246
+ class reverse_view;
247
+
248
+ namespace views { inline constexpr unspecified reverse = unspecified; }
249
+
250
+ // [range.elements], elements view
251
+ template<input_range V, size_t N>
252
+ requires see below;
253
+ class elements_view;
254
+
255
+ template<class R>
256
+ using keys_view = elements_view<views::all_t<R>, 0>;
257
+ template<class R>
258
+ using values_view = elements_view<views::all_t<R>, 1>;
259
+
260
+ namespace views {
261
+ template<size_t N>
262
+ inline constexpr unspecified elements = unspecified ;
263
+ inline constexpr auto keys = elements<0>;
264
+ inline constexpr auto values = elements<1>;
265
+ }
266
+ }
267
+
268
+ namespace std {
269
+ namespace views = ranges::views;
270
+
271
+ template<class I, class S, ranges::subrange_kind K>
272
+ struct tuple_size<ranges::subrange<I, S, K>>
273
+ : integral_constant<size_t, 2> {};
274
+ template<class I, class S, ranges::subrange_kind K>
275
+ struct tuple_element<0, ranges::subrange<I, S, K>> {
276
+ using type = I;
277
+ };
278
+ template<class I, class S, ranges::subrange_kind K>
279
+ struct tuple_element<1, ranges::subrange<I, S, K>> {
280
+ using type = S;
281
+ };
282
+ template<class I, class S, ranges::subrange_kind K>
283
+ struct tuple_element<0, const ranges::subrange<I, S, K>> {
284
+ using type = I;
285
+ };
286
+ template<class I, class S, ranges::subrange_kind K>
287
+ struct tuple_element<1, const ranges::subrange<I, S, K>> {
288
+ using type = S;
289
+ };
290
+ }
291
+ ```
292
+
293
+ Within this clause, for an integer-like type `X`
294
+ [[iterator.concept.winc]], `make-unsigned-like-t<X>` denotes
295
+ `make_unsigned_t<X>` if `X` is an integer type; otherwise, it denotes a
296
+ corresponding unspecified unsigned-integer-like type of the same width
297
+ as `X`. For an expression `x` of type `X`, `to-unsigned-like(x)` is `x`
298
+ explicitly converted to `make-unsigned-like-t<X>`.
299
+