xref: /freebsd/contrib/llvm-project/libcxx/include/ranges (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1fe6060f1SDimitry Andric// -*- C++ -*-
2349cc55cSDimitry Andric//===----------------------------------------------------------------------===//
3fe6060f1SDimitry Andric//
4fe6060f1SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5fe6060f1SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
6fe6060f1SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7fe6060f1SDimitry Andric//
8fe6060f1SDimitry Andric//===----------------------------------------------------------------------===//
9fe6060f1SDimitry Andric
10fe6060f1SDimitry Andric#ifndef _LIBCPP_RANGES
11fe6060f1SDimitry Andric#define _LIBCPP_RANGES
12fe6060f1SDimitry Andric
13fe6060f1SDimitry Andric/*
14fe6060f1SDimitry Andric
15fe6060f1SDimitry Andric#include <compare>              // see [compare.syn]
16fe6060f1SDimitry Andric#include <initializer_list>     // see [initializer.list.syn]
17fe6060f1SDimitry Andric#include <iterator>             // see [iterator.synopsis]
18fe6060f1SDimitry Andric
19fe6060f1SDimitry Andricnamespace std::ranges {
20fe6060f1SDimitry Andric  inline namespace unspecified {
21fe6060f1SDimitry Andric    // [range.access], range access
22fe6060f1SDimitry Andric    inline constexpr unspecified begin = unspecified;
23fe6060f1SDimitry Andric    inline constexpr unspecified end = unspecified;
24fe6060f1SDimitry Andric    inline constexpr unspecified cbegin = unspecified;
25fe6060f1SDimitry Andric    inline constexpr unspecified cend = unspecified;
26fe6060f1SDimitry Andric
27fe6060f1SDimitry Andric    inline constexpr unspecified size = unspecified;
28fe6060f1SDimitry Andric    inline constexpr unspecified ssize = unspecified;
29fe6060f1SDimitry Andric  }
30fe6060f1SDimitry Andric
31fe6060f1SDimitry Andric  // [range.range], ranges
32fe6060f1SDimitry Andric  template<class T>
33fe6060f1SDimitry Andric    concept range = see below;
34fe6060f1SDimitry Andric
35fe6060f1SDimitry Andric  template<class T>
36fe6060f1SDimitry Andric    inline constexpr bool enable_borrowed_range = false;
37fe6060f1SDimitry Andric
38fe6060f1SDimitry Andric  template<class T>
394824e7fdSDimitry Andric    using iterator_t = decltype(ranges::begin(declval<T&>()));
40fe6060f1SDimitry Andric  template<range R>
41fe6060f1SDimitry Andric    using sentinel_t = decltype(ranges::end(declval<R&>()));
42fe6060f1SDimitry Andric  template<range R>
43fe6060f1SDimitry Andric    using range_difference_t = iter_difference_t<iterator_t<R>>;
44fe6060f1SDimitry Andric  template<sized_range R>
45fe6060f1SDimitry Andric    using range_size_t = decltype(ranges::size(declval<R&>()));
46fe6060f1SDimitry Andric  template<range R>
47fe6060f1SDimitry Andric    using range_value_t = iter_value_t<iterator_t<R>>;
48fe6060f1SDimitry Andric  template<range R>
49fe6060f1SDimitry Andric    using range_reference_t = iter_reference_t<iterator_t<R>>;
50fe6060f1SDimitry Andric  template<range R>
51fe6060f1SDimitry Andric    using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
5206c3fb27SDimitry Andric  template <range R>
5306c3fb27SDimitry Andric    using range_common_reference_t = iter_common_reference_t<iterator_t<R>>;
54fe6060f1SDimitry Andric
55fe6060f1SDimitry Andric  // [range.sized], sized ranges
56fe6060f1SDimitry Andric  template<class>
57fe6060f1SDimitry Andric    inline constexpr bool disable_sized_range = false;
58fe6060f1SDimitry Andric
59fe6060f1SDimitry Andric  template<class T>
60fe6060f1SDimitry Andric    concept sized_range = ...;
61fe6060f1SDimitry Andric
62fe6060f1SDimitry Andric  // [range.view], views
63fe6060f1SDimitry Andric  template<class T>
64fe6060f1SDimitry Andric    inline constexpr bool enable_view = ...;
65fe6060f1SDimitry Andric
66fe6060f1SDimitry Andric  struct view_base { };
67fe6060f1SDimitry Andric
68fe6060f1SDimitry Andric  template<class T>
69fe6060f1SDimitry Andric    concept view = ...;
70fe6060f1SDimitry Andric
71fe6060f1SDimitry Andric  // [range.refinements], other range refinements
72fe6060f1SDimitry Andric  template<class R, class T>
73fe6060f1SDimitry Andric    concept output_range = see below;
74fe6060f1SDimitry Andric
75fe6060f1SDimitry Andric  template<class T>
76fe6060f1SDimitry Andric    concept input_range = see below;
77fe6060f1SDimitry Andric
78fe6060f1SDimitry Andric  template<class T>
79fe6060f1SDimitry Andric    concept forward_range = see below;
80fe6060f1SDimitry Andric
81fe6060f1SDimitry Andric  template<class T>
82fe6060f1SDimitry Andric  concept bidirectional_range = see below;
83fe6060f1SDimitry Andric
84fe6060f1SDimitry Andric  template<class T>
85fe6060f1SDimitry Andric  concept random_access_range = see below;
86fe6060f1SDimitry Andric
87fe6060f1SDimitry Andric  template<class T>
88fe6060f1SDimitry Andric  concept contiguous_range = see below;
89fe6060f1SDimitry Andric
90fe6060f1SDimitry Andric  template <class _Tp>
91fe6060f1SDimitry Andric    concept common_range = see below;
92fe6060f1SDimitry Andric
93fe6060f1SDimitry Andric  template<class T>
94fe6060f1SDimitry Andric  concept viewable_range = see below;
95fe6060f1SDimitry Andric
96*0fca6ea1SDimitry Andric  // [range.adaptor.object], range adaptor objects
97*0fca6ea1SDimitry Andric  template<class D>
98*0fca6ea1SDimitry Andric    requires is_class_v<D> && same_as<D, remove_cv_t<D>>
99*0fca6ea1SDimitry Andric  class range_adaptor_closure { };  // Since c++23
100*0fca6ea1SDimitry Andric
101fe6060f1SDimitry Andric  // [view.interface], class template view_interface
102fe6060f1SDimitry Andric  template<class D>
103fe6060f1SDimitry Andric    requires is_class_v<D> && same_as<D, remove_cv_t<D>>
104fe6060f1SDimitry Andric  class view_interface;
105fe6060f1SDimitry Andric
106fe6060f1SDimitry Andric  // [range.subrange], sub-ranges
107fe6060f1SDimitry Andric  enum class subrange_kind : bool { unsized, sized };
108fe6060f1SDimitry Andric
109fe6060f1SDimitry Andric  template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below>
110fe6060f1SDimitry Andric    requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
111fe6060f1SDimitry Andric  class subrange;
112fe6060f1SDimitry Andric
113fe6060f1SDimitry Andric  template<class I, class S, subrange_kind K>
114fe6060f1SDimitry Andric    inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
115fe6060f1SDimitry Andric
116fe6060f1SDimitry Andric  // [range.dangling], dangling iterator handling
117fe6060f1SDimitry Andric  struct dangling;
118fe6060f1SDimitry Andric
119fe6060f1SDimitry Andric  template<range R>
120fe6060f1SDimitry Andric    using borrowed_iterator_t = see below;
121fe6060f1SDimitry Andric
122fe6060f1SDimitry Andric  template<range R>
123fe6060f1SDimitry Andric    using borrowed_subrange_t = see below;
124fe6060f1SDimitry Andric
125bdd1243dSDimitry Andric  // [range.elements], elements view
126bdd1243dSDimitry Andric  template<input_range V, size_t N>
127bdd1243dSDimitry Andric    requires see below
128bdd1243dSDimitry Andric  class elements_view;
129bdd1243dSDimitry Andric
130bdd1243dSDimitry Andric  template<class T, size_t N>
131bdd1243dSDimitry Andric    inline constexpr bool enable_borrowed_range<elements_view<T, N>> =
132bdd1243dSDimitry Andric      enable_borrowed_range<T>;
133bdd1243dSDimitry Andric
134bdd1243dSDimitry Andric  template<class R>
135bdd1243dSDimitry Andric    using keys_view = elements_view<R, 0>;
136bdd1243dSDimitry Andric  template<class R>
137bdd1243dSDimitry Andric    using values_view = elements_view<R, 1>;
138bdd1243dSDimitry Andric
139bdd1243dSDimitry Andric  namespace views {
140bdd1243dSDimitry Andric    template<size_t N>
141bdd1243dSDimitry Andric      inline constexpr unspecified elements = unspecified;
142bdd1243dSDimitry Andric    inline constexpr auto keys = elements<0>;
143bdd1243dSDimitry Andric    inline constexpr auto values = elements<1>;
144bdd1243dSDimitry Andric  }
145bdd1243dSDimitry Andric
14606c3fb27SDimitry Andric  // [range.utility.conv], range conversions
14706c3fb27SDimitry Andric  template<class C, input_range R, class... Args> requires (!view<C>)
14806c3fb27SDimitry Andric    constexpr C to(R&& r, Args&&... args);     // Since C++23
14906c3fb27SDimitry Andric  template<template<class...> class C, input_range R, class... Args>
15006c3fb27SDimitry Andric    constexpr auto to(R&& r, Args&&... args);  // Since C++23
15106c3fb27SDimitry Andric  template<class C, class... Args> requires (!view<C>)
15206c3fb27SDimitry Andric    constexpr auto to(Args&&... args);         // Since C++23
15306c3fb27SDimitry Andric  template<template<class...> class C, class... Args>
15406c3fb27SDimitry Andric    constexpr auto to(Args&&... args);         // Since C++23
15506c3fb27SDimitry Andric
156fe6060f1SDimitry Andric  // [range.empty], empty view
157fe6060f1SDimitry Andric  template<class T>
158fe6060f1SDimitry Andric    requires is_object_v<T>
159fe6060f1SDimitry Andric  class empty_view;
160fe6060f1SDimitry Andric
16181ad6265SDimitry Andric  template<class T>
16281ad6265SDimitry Andric    inline constexpr bool enable_borrowed_range<empty_view<T>> = true;
16381ad6265SDimitry Andric
16481ad6265SDimitry Andric  namespace views {
16581ad6265SDimitry Andric    template<class T>
16681ad6265SDimitry Andric      inline constexpr empty_view<T> empty{};
16781ad6265SDimitry Andric  }
16881ad6265SDimitry Andric
169fe6060f1SDimitry Andric  // [range.all], all view
170fe6060f1SDimitry Andric  namespace views {
171fe6060f1SDimitry Andric    inline constexpr unspecified all = unspecified;
172fe6060f1SDimitry Andric
173fe6060f1SDimitry Andric    template<viewable_range R>
174fe6060f1SDimitry Andric      using all_t = decltype(all(declval<R>()));
175fe6060f1SDimitry Andric  }
176fe6060f1SDimitry Andric
177fe6060f1SDimitry Andric  template<range R>
178fe6060f1SDimitry Andric    requires is_object_v<R>
179fe6060f1SDimitry Andric  class ref_view;
180fe6060f1SDimitry Andric
181fe6060f1SDimitry Andric  template<class T>
182fe6060f1SDimitry Andric    inline constexpr bool enable_borrowed_range<ref_view<T>> = true;
183fe6060f1SDimitry Andric
18404eeddc0SDimitry Andric  template<range R>
18504eeddc0SDimitry Andric    requires see below
18604eeddc0SDimitry Andric  class owning_view;
18704eeddc0SDimitry Andric
18804eeddc0SDimitry Andric  template<class T>
18904eeddc0SDimitry Andric    inline constexpr bool enable_borrowed_range<owning_view<T>> = enable_borrowed_range<T>;
19004eeddc0SDimitry Andric
19181ad6265SDimitry Andric  // [range.filter], filter view
19281ad6265SDimitry Andric  template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
19381ad6265SDimitry Andric    requires view<V> && is_object_v<Pred>
19481ad6265SDimitry Andric  class filter_view;
19581ad6265SDimitry Andric
19681ad6265SDimitry Andric  namespace views {
19781ad6265SDimitry Andric    inline constexpr unspecified filter = unspecified;
19881ad6265SDimitry Andric  }
19981ad6265SDimitry Andric
200fe6060f1SDimitry Andric  // [range.drop], drop view
201fe6060f1SDimitry Andric  template<view V>
202fe6060f1SDimitry Andric    class drop_view;
203fe6060f1SDimitry Andric
204fe6060f1SDimitry Andric  template<class T>
205fe6060f1SDimitry Andric    inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>;
206fe6060f1SDimitry Andric
207bdd1243dSDimitry Andric  // [range.drop.while], drop while view
208bdd1243dSDimitry Andric  template<view V, class Pred>
209bdd1243dSDimitry Andric    requires input_range<V> && is_object_v<Pred> &&
210bdd1243dSDimitry Andric             indirect_unary_predicate<const Pred, iterator_t<V>>
211bdd1243dSDimitry Andric    class drop_while_view;
212bdd1243dSDimitry Andric
213bdd1243dSDimitry Andric  template<class T, class Pred>
214bdd1243dSDimitry Andric    inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =
215bdd1243dSDimitry Andric      enable_borrowed_range<T>;
216bdd1243dSDimitry Andric
217bdd1243dSDimitry Andric  namespace views { inline constexpr unspecified drop_while = unspecified; }
218bdd1243dSDimitry Andric
219fe6060f1SDimitry Andric  // [range.transform], transform view
220fe6060f1SDimitry Andric  template<input_range V, copy_constructible F>
221fe6060f1SDimitry Andric    requires view<V> && is_object_v<F> &&
222fe6060f1SDimitry Andric             regular_invocable<F&, range_reference_t<V>> &&
223fe6060f1SDimitry Andric             can-reference<invoke_result_t<F&, range_reference_t<V>>>
224fe6060f1SDimitry Andric  class transform_view;
225fe6060f1SDimitry Andric
226349cc55cSDimitry Andric  // [range.counted], counted view
227349cc55cSDimitry Andric  namespace views { inline constexpr unspecified counted = unspecified; }
228349cc55cSDimitry Andric
229fe6060f1SDimitry Andric  // [range.common], common view
230fe6060f1SDimitry Andric  template<view V>
231fe6060f1SDimitry Andric    requires (!common_range<V> && copyable<iterator_t<V>>)
232fe6060f1SDimitry Andric  class common_view;
233fe6060f1SDimitry Andric
234349cc55cSDimitry Andric // [range.reverse], reverse view
235349cc55cSDimitry Andric  template<view V>
236349cc55cSDimitry Andric    requires bidirectional_range<V>
237349cc55cSDimitry Andric  class reverse_view;
238349cc55cSDimitry Andric
239349cc55cSDimitry Andric  template<class T>
240349cc55cSDimitry Andric    inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>;
241349cc55cSDimitry Andric
242fe6060f1SDimitry Andric  template<class T>
243fe6060f1SDimitry Andric  inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>;
244349cc55cSDimitry Andric
245349cc55cSDimitry Andric   // [range.take], take view
246349cc55cSDimitry Andric  template<view> class take_view;
247349cc55cSDimitry Andric
248349cc55cSDimitry Andric  template<class T>
249349cc55cSDimitry Andric  inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>;
250349cc55cSDimitry Andric
251bdd1243dSDimitry Andric    // [range.take.while], take while view
252bdd1243dSDimitry Andric  template<view V, class Pred>
253bdd1243dSDimitry Andric    requires input_range<V> && is_object_v<Pred> &&
254bdd1243dSDimitry Andric             indirect_unary_predicate<const Pred, iterator_t<V>>
255bdd1243dSDimitry Andric    class take_while_view;
256bdd1243dSDimitry Andric
257bdd1243dSDimitry Andric  namespace views { inline constexpr unspecified take_while = unspecified; }
258bdd1243dSDimitry Andric
259349cc55cSDimitry Andric  template<copy_constructible T>
260349cc55cSDimitry Andric    requires is_object_v<T>
261349cc55cSDimitry Andric  class single_view;
262349cc55cSDimitry Andric
263349cc55cSDimitry Andric  template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
264349cc55cSDimitry Andric    requires weakly-equality-comparable-with<W, Bound> && copyable<W>
265349cc55cSDimitry Andric  class iota_view;
266349cc55cSDimitry Andric
267349cc55cSDimitry Andric  template<class W, class Bound>
268349cc55cSDimitry Andric    inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
269349cc55cSDimitry Andric
27006c3fb27SDimitry Andric  // [range.repeat], repeat view
27106c3fb27SDimitry Andric  template<class T>
27206c3fb27SDimitry Andric    concept integer-like-with-usable-difference-type =  // exposition only
27306c3fb27SDimitry Andric      is-signed-integer-like<T> || (is-integer-like<T> && weakly_incrementable<T>);
27406c3fb27SDimitry Andric
27506c3fb27SDimitry Andric  template<move_constructible T, semiregular Bound = unreachable_sentinel_t>
27606c3fb27SDimitry Andric    requires (is_object_v<T> && same_as<T, remove_cv_t<T>> &&
27706c3fb27SDimitry Andric              (integer-like-with-usable-difference-type<Bound> ||
27806c3fb27SDimitry Andric               same_as<Bound, unreachable_sentinel_t>))
27906c3fb27SDimitry Andric  class repeat_view;
28006c3fb27SDimitry Andric
28106c3fb27SDimitry Andric  namespace views { inline constexpr unspecified repeat = unspecified; }
28206c3fb27SDimitry Andric
283349cc55cSDimitry Andric  // [range.join], join view
284349cc55cSDimitry Andric  template<input_range V>
285349cc55cSDimitry Andric    requires view<V> && input_range<range_reference_t<V>>
286349cc55cSDimitry Andric  class join_view;
28781ad6265SDimitry Andric
28881ad6265SDimitry Andric  // [range.lazy.split], lazy split view
28981ad6265SDimitry Andric  template<class R>
29081ad6265SDimitry Andric    concept tiny-range = see below;   // exposition only
29181ad6265SDimitry Andric
29281ad6265SDimitry Andric  template<input_range V, forward_range Pattern>
29381ad6265SDimitry Andric    requires view<V> && view<Pattern> &&
29481ad6265SDimitry Andric             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
29581ad6265SDimitry Andric             (forward_range<V> || tiny-range<Pattern>)
29681ad6265SDimitry Andric  class lazy_split_view;
29781ad6265SDimitry Andric
298bdd1243dSDimitry Andric  // [range.split], split view
299bdd1243dSDimitry Andric  template<forward_range V, forward_range Pattern>
300bdd1243dSDimitry Andric    requires view<V> && view<Pattern> &&
301bdd1243dSDimitry Andric             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
302bdd1243dSDimitry Andric  class split_view;
303bdd1243dSDimitry Andric
30481ad6265SDimitry Andric  namespace views {
30581ad6265SDimitry Andric    inline constexpr unspecified lazy_split = unspecified;
306bdd1243dSDimitry Andric    inline constexpr unspecified split = unspecified;
307fe6060f1SDimitry Andric  }
308fe6060f1SDimitry Andric
309bdd1243dSDimitry Andric  // [range.istream], istream view
310bdd1243dSDimitry Andric  template<movable Val, class CharT, class Traits = char_traits<CharT>>
311bdd1243dSDimitry Andric    requires see below
312bdd1243dSDimitry Andric  class basic_istream_view;
313bdd1243dSDimitry Andric
314bdd1243dSDimitry Andric  template<class Val>
315bdd1243dSDimitry Andric    using istream_view = basic_istream_view<Val, char>;
316bdd1243dSDimitry Andric
317bdd1243dSDimitry Andric  template<class Val>
318bdd1243dSDimitry Andric    using wistream_view = basic_istream_view<Val, wchar_t>;
319bdd1243dSDimitry Andric
320bdd1243dSDimitry Andric  namespace views { template<class T> inline constexpr unspecified istream = unspecified; }
321bdd1243dSDimitry Andric
32281ad6265SDimitry Andric  // [range.zip], zip view
32381ad6265SDimitry Andric  template<input_range... Views>
32481ad6265SDimitry Andric    requires (view<Views> && ...) && (sizeof...(Views) > 0)
32506c3fb27SDimitry Andric  class zip_view;        // C++23
32681ad6265SDimitry Andric
32781ad6265SDimitry Andric  template<class... Views>
32806c3fb27SDimitry Andric    inline constexpr bool enable_borrowed_range<zip_view<Views...>> =       // C++23
32981ad6265SDimitry Andric      (enable_borrowed_range<Views> && ...);
33081ad6265SDimitry Andric
33106c3fb27SDimitry Andric  namespace views { inline constexpr unspecified zip = unspecified; }       // C++23
332bdd1243dSDimitry Andric
333bdd1243dSDimitry Andric  // [range.as.rvalue]
334bdd1243dSDimitry Andric  template <view V>
335bdd1243dSDimitry Andric    requires input_range<V>
3365f757f3fSDimitry Andric  class as_rvalue_view;                                                     // C++23
337bdd1243dSDimitry Andric
3385f757f3fSDimitry Andric  namespace views { inline constexpr unspecified as_rvalue ) unspecified; } // C++23
3395f757f3fSDimitry Andric
3405f757f3fSDimitry Andric  [range.chunk.by]
3415f757f3fSDimitry Andric  template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
3425f757f3fSDimitry Andric    requires view<V> && is_object_v<Pred>
3435f757f3fSDimitry Andric  class chunk_by_view;                                                      // C++23
3445f757f3fSDimitry Andric
3455f757f3fSDimitry Andric  namespace views { inline constexpr unspecified chunk_by = unspecified; }  // C++23
34681ad6265SDimitry Andric}
34781ad6265SDimitry Andric
34881ad6265SDimitry Andricnamespace std {
34981ad6265SDimitry Andric  namespace views = ranges::views;
35081ad6265SDimitry Andric
35181ad6265SDimitry Andric  template<class T> struct tuple_size;
35281ad6265SDimitry Andric  template<size_t I, class T> struct tuple_element;
35381ad6265SDimitry Andric
35481ad6265SDimitry Andric  template<class I, class S, ranges::subrange_kind K>
35581ad6265SDimitry Andric  struct tuple_size<ranges::subrange<I, S, K>>
35681ad6265SDimitry Andric    : integral_constant<size_t, 2> {};
35781ad6265SDimitry Andric
35881ad6265SDimitry Andric  template<class I, class S, ranges::subrange_kind K>
35981ad6265SDimitry Andric  struct tuple_element<0, ranges::subrange<I, S, K>> {
36081ad6265SDimitry Andric    using type = I;
36181ad6265SDimitry Andric  };
36281ad6265SDimitry Andric
36381ad6265SDimitry Andric  template<class I, class S, ranges::subrange_kind K>
36481ad6265SDimitry Andric  struct tuple_element<1, ranges::subrange<I, S, K>> {
36581ad6265SDimitry Andric    using type = S;
36681ad6265SDimitry Andric  };
36781ad6265SDimitry Andric
36881ad6265SDimitry Andric  template<class I, class S, ranges::subrange_kind K>
36981ad6265SDimitry Andric  struct tuple_element<0, const ranges::subrange<I, S, K>> {
37081ad6265SDimitry Andric    using type = I;
37181ad6265SDimitry Andric  };
37281ad6265SDimitry Andric
37381ad6265SDimitry Andric  template<class I, class S, ranges::subrange_kind K>
37481ad6265SDimitry Andric  struct tuple_element<1, const ranges::subrange<I, S, K>> {
37581ad6265SDimitry Andric    using type = S;
37681ad6265SDimitry Andric  };
37706c3fb27SDimitry Andric
37806c3fb27SDimitry Andric  struct from_range_t { explicit from_range_t() = default; };  // Since C++23
37906c3fb27SDimitry Andric  inline constexpr from_range_t from_range{};                  // Since C++23
38081ad6265SDimitry Andric}
381fe6060f1SDimitry Andric*/
382fe6060f1SDimitry Andric
383fe6060f1SDimitry Andric#include <__config>
384*0fca6ea1SDimitry Andric
385*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 20
386fe6060f1SDimitry Andric#  include <__ranges/access.h>
387fe6060f1SDimitry Andric#  include <__ranges/all.h>
388fe6060f1SDimitry Andric#  include <__ranges/common_view.h>
389fe6060f1SDimitry Andric#  include <__ranges/concepts.h>
390349cc55cSDimitry Andric#  include <__ranges/counted.h>
391fe6060f1SDimitry Andric#  include <__ranges/dangling.h>
392fe6060f1SDimitry Andric#  include <__ranges/data.h>
393fe6060f1SDimitry Andric#  include <__ranges/drop_view.h>
394bdd1243dSDimitry Andric#  include <__ranges/drop_while_view.h>
395bdd1243dSDimitry Andric#  include <__ranges/elements_view.h>
396349cc55cSDimitry Andric#  include <__ranges/empty.h>
39704eeddc0SDimitry Andric#  include <__ranges/empty_view.h>
398fe6060f1SDimitry Andric#  include <__ranges/enable_borrowed_range.h>
399fe6060f1SDimitry Andric#  include <__ranges/enable_view.h>
40081ad6265SDimitry Andric#  include <__ranges/filter_view.h>
401349cc55cSDimitry Andric#  include <__ranges/iota_view.h>
402349cc55cSDimitry Andric#  include <__ranges/join_view.h>
40381ad6265SDimitry Andric#  include <__ranges/lazy_split_view.h>
40481ad6265SDimitry Andric#  include <__ranges/rbegin.h>
405fe6060f1SDimitry Andric#  include <__ranges/ref_view.h>
40681ad6265SDimitry Andric#  include <__ranges/rend.h>
407349cc55cSDimitry Andric#  include <__ranges/reverse_view.h>
408349cc55cSDimitry Andric#  include <__ranges/single_view.h>
409fe6060f1SDimitry Andric#  include <__ranges/size.h>
410bdd1243dSDimitry Andric#  include <__ranges/split_view.h>
411fe6060f1SDimitry Andric#  include <__ranges/subrange.h>
412349cc55cSDimitry Andric#  include <__ranges/take_view.h>
413bdd1243dSDimitry Andric#  include <__ranges/take_while_view.h>
414fe6060f1SDimitry Andric#  include <__ranges/transform_view.h>
415fe6060f1SDimitry Andric#  include <__ranges/view_interface.h>
41653683b95SDimitry Andric#  include <__ranges/views.h>
417fe6060f1SDimitry Andric
418bdd1243dSDimitry Andric#  if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
419bdd1243dSDimitry Andric#    include <__ranges/istream_view.h>
420bdd1243dSDimitry Andric#  endif
421*0fca6ea1SDimitry Andric#endif
422*0fca6ea1SDimitry Andric
423*0fca6ea1SDimitry Andric#if _LIBCPP_STD_VER >= 23
424*0fca6ea1SDimitry Andric#  include <__ranges/as_rvalue_view.h>
425*0fca6ea1SDimitry Andric#  include <__ranges/chunk_by_view.h>
426*0fca6ea1SDimitry Andric#  include <__ranges/from_range.h>
427*0fca6ea1SDimitry Andric#  include <__ranges/repeat_view.h>
428*0fca6ea1SDimitry Andric#  include <__ranges/to.h>
429*0fca6ea1SDimitry Andric#  include <__ranges/zip_view.h>
430*0fca6ea1SDimitry Andric#endif
431*0fca6ea1SDimitry Andric
432*0fca6ea1SDimitry Andric#include <version>
433bdd1243dSDimitry Andric
434bdd1243dSDimitry Andric// standard-mandated includes
435bdd1243dSDimitry Andric
436bdd1243dSDimitry Andric// [ranges.syn]
437bdd1243dSDimitry Andric#include <compare>
438bdd1243dSDimitry Andric#include <initializer_list>
439bdd1243dSDimitry Andric#include <iterator>
440bdd1243dSDimitry Andric
441bdd1243dSDimitry Andric// [tuple.helper]
44206c3fb27SDimitry Andric#include <__tuple/tuple_element.h>
44306c3fb27SDimitry Andric#include <__tuple/tuple_size.h>
444bdd1243dSDimitry Andric
445fe6060f1SDimitry Andric#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
446fe6060f1SDimitry Andric#  pragma GCC system_header
447fe6060f1SDimitry Andric#endif
448fe6060f1SDimitry Andric
449*0fca6ea1SDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
450*0fca6ea1SDimitry Andric#  include <cstddef>
451*0fca6ea1SDimitry Andric#  include <limits>
452*0fca6ea1SDimitry Andric#  include <optional>
453*0fca6ea1SDimitry Andric#  include <span>
454*0fca6ea1SDimitry Andric#  include <tuple>
455*0fca6ea1SDimitry Andric#endif
456*0fca6ea1SDimitry Andric
45706c3fb27SDimitry Andric#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
45806c3fb27SDimitry Andric#  include <cstdlib>
4595f757f3fSDimitry Andric#  include <iosfwd>
46006c3fb27SDimitry Andric#  include <type_traits>
46106c3fb27SDimitry Andric#endif
46206c3fb27SDimitry Andric
463fe6060f1SDimitry Andric#endif // _LIBCPP_RANGES
464