xref: /freebsd/contrib/llvm-project/libcxx/modules/std/ranges.inc (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10export namespace std {
11  namespace ranges {
12    inline namespace __cpo {
13      // [range.access], range access
14      using std::ranges::__cpo::begin;
15      using std::ranges::__cpo::cbegin;
16      using std::ranges::__cpo::cend;
17      using std::ranges::__cpo::crbegin;
18      using std::ranges::__cpo::crend;
19      using std::ranges::__cpo::end;
20      using std::ranges::__cpo::rbegin;
21      using std::ranges::__cpo::rend;
22
23      using std::ranges::__cpo::cdata;
24      using std::ranges::__cpo::data;
25      using std::ranges::__cpo::empty;
26      using std::ranges::__cpo::size;
27      using std::ranges::__cpo::ssize;
28    } // namespace __cpo
29
30    // [range.range], ranges
31    using std::ranges::range;
32
33    using std::ranges::enable_borrowed_range;
34
35    using std::ranges::borrowed_range;
36
37    // using std::ranges::const_iterator_t;
38    // using std::ranges::const_sentinel_t;
39    using std::ranges::iterator_t;
40    // using std::ranges::range_const_reference_t;
41    using std::ranges::range_common_reference_t;
42    using std::ranges::range_difference_t;
43    using std::ranges::range_reference_t;
44    using std::ranges::range_rvalue_reference_t;
45    using std::ranges::range_size_t;
46    using std::ranges::range_value_t;
47    using std::ranges::sentinel_t;
48
49    // [range.sized], sized ranges
50    using std::ranges::disable_sized_range;
51    using std::ranges::sized_range;
52
53    // [range.view], views
54    using std::ranges::enable_view;
55    using std::ranges::view;
56    using std::ranges::view_base;
57
58    // [range.refinements], other range refinements
59    using std::ranges::bidirectional_range;
60    using std::ranges::common_range;
61    // using std::ranges::constant_range;
62    using std::ranges::contiguous_range;
63    using std::ranges::forward_range;
64    using std::ranges::input_range;
65    using std::ranges::output_range;
66    using std::ranges::random_access_range;
67    using std::ranges::viewable_range;
68
69    // [view.interface], class template view_­interface
70    using std::ranges::view_interface;
71
72    // [range.subrange], sub-ranges
73    using std::ranges::subrange;
74    using std::ranges::subrange_kind;
75
76    using std::ranges::get;
77  } // namespace ranges
78
79  using std::ranges::get;
80
81  namespace ranges {
82
83    // [range.dangling], dangling iterator handling
84    using std::ranges::dangling;
85
86    // [range.elementsof], class template elements_­of
87    // using std::ranges::elements_of;
88
89    using std::ranges::borrowed_iterator_t;
90
91    using std::ranges::borrowed_subrange_t;
92
93#if _LIBCPP_STD_VER >= 23
94    // [range.utility.conv], range conversions
95    using std::ranges::to;
96#endif
97
98    // [range.empty], empty view
99    using std::ranges::empty_view;
100
101    namespace views {
102      using std::ranges::views::empty;
103    }
104
105    // [range.single], single view
106    using std::ranges::single_view;
107
108    namespace views {
109      using std::ranges::views::single;
110    } // namespace views
111
112    // [range.iota], iota view
113    using std::ranges::iota_view;
114
115    namespace views {
116      using std::ranges::views::iota;
117    } // namespace views
118
119#if _LIBCPP_STD_VER >= 23
120    // [range.repeat], repeat view
121    using std::ranges::repeat_view;
122
123    namespace views {
124      using std::ranges::views::repeat;
125    } // namespace views
126#endif // _LIBCPP_STD_VER >= 23
127
128#ifndef _LIBCPP_HAS_NO_LOCALIZATION
129    // [range.istream], istream view
130    using std::ranges::basic_istream_view;
131    using std::ranges::istream_view;
132#  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
133    using std::ranges::wistream_view;
134#  endif
135
136    namespace views {
137      using std::ranges::views::istream;
138    }
139#endif // _LIBCPP_HAS_NO_LOCALIZATION
140
141    // Note: This declaration not in the synopsis or explicitly in the wording.
142    // However it is needed for the range adaptors.
143    // [range.adaptor.object]/3
144    //   The template parameter D for range_adaptor_closure may be an
145    //   incomplete type. If an expression of type cv D is used as an operand
146    //   to the | operator, D shall be complete and model
147    //   derived_from<range_adaptor_closure<D>>. The behavior of an expression
148    //   involving an object of type cv D as an operand to the | operator is
149    //   undefined if overload resolution selects a program-defined operator|
150    //   function.
151    // This is used internally in C++20 mode.
152    using std::ranges::operator|;
153#if _LIBCPP_STD_VER >= 23
154    // [range.adaptor.object], range adaptor objects
155    using std::ranges::range_adaptor_closure;
156#endif
157
158    // [range.all], all view
159    namespace views {
160      using std::ranges::views::all;
161      using std::ranges::views::all_t;
162    } // namespace views
163
164    // [range.ref.view], ref view
165    using std::ranges::ref_view;
166
167    // [range.owning.view], owning view
168    using std::ranges::owning_view;
169
170#if _LIBCPP_STD_VER >= 23
171    // [range.as.rvalue], as rvalue view
172    using std::ranges::as_rvalue_view;
173
174    namespace views {
175      using std::ranges::views::as_rvalue;
176    } // namespace views
177#endif // _LIBCPP_STD_VER >= 23
178
179    // [range.filter], filter view
180    using std::ranges::filter_view;
181
182    namespace views {
183      using std::ranges::views::filter;
184    } // namespace views
185
186    // [range.transform], transform view
187    using std::ranges::transform_view;
188
189    namespace views {
190      using std::ranges::views::transform;
191    } // namespace views
192
193    // [range.take], take view
194    using std::ranges::take_view;
195
196    namespace views {
197      using std::ranges::views::take;
198    } // namespace views
199
200    // [range.take.while], take while view
201    using std::ranges::take_while_view;
202
203    namespace views {
204      using std::ranges::views::take_while;
205    } // namespace views
206
207    // [range.drop], drop view
208    using std::ranges::drop_view;
209
210    namespace views {
211      using std::ranges::views::drop;
212    } // namespace views
213
214    // [range.drop.while], drop while view
215    using std::ranges::drop_while_view;
216
217    namespace views {
218      using std::ranges::views::drop_while;
219    } // namespace views
220
221    using std::ranges::join_view;
222
223    namespace views {
224      using std::ranges::views::join;
225    } // namespace views
226#if 0
227    using std::ranges::join_with_view;
228
229    namespace views {
230      using std::ranges::views::join_with;
231    } // namespace views
232#endif
233    using std::ranges::lazy_split_view;
234
235    // [range.split], split view
236    using std::ranges::split_view;
237
238    namespace views {
239      using std::ranges::views::lazy_split;
240      using std::ranges::views::split;
241    } // namespace views
242
243    // [range.counted], counted view
244    namespace views {
245      using std::ranges::views::counted;
246    } // namespace views
247
248    // [range.common], common view
249    using std::ranges::common_view;
250
251    namespace views {
252      using std::ranges::views::common;
253    } // namespace views
254
255    // [range.reverse], reverse view
256    using std::ranges::reverse_view;
257
258    namespace views {
259      using std::ranges::views::reverse;
260    } // namespace views
261
262    // [range.as.const], as const view
263#if 0
264    using std::ranges::as_const_view;
265
266    namespace views {
267      using std::ranges::views::as_const;
268    } // namespace views
269#endif
270    // [range.elements], elements view
271    using std::ranges::elements_view;
272
273    using std::ranges::keys_view;
274    using std::ranges::values_view;
275
276    namespace views {
277      using std::ranges::views::elements;
278      using std::ranges::views::keys;
279      using std::ranges::views::values;
280    } // namespace views
281
282#if _LIBCPP_STD_VER >= 23
283    // [range.zip], zip view
284    using std::ranges::zip_view;
285
286    namespace views {
287      using std::ranges::views::zip;
288    } // namespace views
289#endif // _LIBCPP_STD_VER >= 23
290
291#if 0
292    // [range.zip.transform], zip transform view
293    using std::ranges::zip_transform_view;
294
295    namespace views {
296      using std::ranges::views::zip_transform;
297    }
298
299    using std::ranges::adjacent_view;
300
301    namespace views {
302      using std::ranges::views::adjacent;
303      using std::ranges::views::pairwise;
304    } // namespace views
305
306    using std::ranges::adjacent_transform_view;
307
308    namespace views {
309      using std::ranges::views::adjacent_transform;
310      using std::ranges::views::pairwise_transform;
311    } // namespace views
312
313    using std::ranges::chunk_view;
314
315    using std::ranges::chunk_view<V>;
316
317    namespace views {
318      using std::ranges::views::chunk;
319    }
320
321    using std::ranges::slide_view;
322
323    namespace views {
324      using std::ranges::views::slide;
325    }
326#endif
327
328#if _LIBCPP_STD_VER >= 23
329    // [range.chunk.by], chunk by view
330    using std::ranges::chunk_by_view;
331
332    namespace views {
333      using std::ranges::views::chunk_by;
334    }
335#endif // _LIBCPP_STD_VER >= 23
336
337#if 0
338    // [range.stride], stride view
339    using std::ranges::stride_view;
340
341    namespace views {
342      using std::ranges::views::stride;
343    }
344
345    using std::ranges::cartesian_product_view;
346
347    namespace views {
348      using std::ranges::views::cartesian_product;
349    }
350#endif
351  } // namespace ranges
352
353  namespace views = ranges::views;
354
355  using std::tuple_element;
356  using std::tuple_size;
357
358#if _LIBCPP_STD_VER >= 23
359  using std::from_range;
360  using std::from_range_t;
361#endif // _LIBCPP_STD_VER >= 23
362} // namespace std
363