Warning, /include/c++/v1/__cxx03/ranges is written in an unsupported language. File is not indexed.
0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009
0010 #ifndef _LIBCPP___CXX03_RANGES
0011 #define _LIBCPP___CXX03_RANGES
0012
0013 /*
0014
0015 #include <__cxx03/compare> // see [compare.syn]
0016 #include <__cxx03/initializer_list> // see [initializer.list.syn]
0017 #include <__cxx03/iterator> // see [iterator.synopsis]
0018
0019 namespace std::ranges {
0020 inline namespace unspecified {
0021 // [range.access], range access
0022 inline constexpr unspecified begin = unspecified;
0023 inline constexpr unspecified end = unspecified;
0024 inline constexpr unspecified cbegin = unspecified;
0025 inline constexpr unspecified cend = unspecified;
0026
0027 inline constexpr unspecified size = unspecified;
0028 inline constexpr unspecified ssize = unspecified;
0029 }
0030
0031 // [range.range], ranges
0032 template<class T>
0033 concept range = see below;
0034
0035 template<class T>
0036 inline constexpr bool enable_borrowed_range = false;
0037
0038 template<class T>
0039 using iterator_t = decltype(ranges::begin(declval<T&>()));
0040 template<range R>
0041 using sentinel_t = decltype(ranges::end(declval<R&>()));
0042 template<range R>
0043 using range_difference_t = iter_difference_t<iterator_t<R>>;
0044 template<sized_range R>
0045 using range_size_t = decltype(ranges::size(declval<R&>()));
0046 template<range R>
0047 using range_value_t = iter_value_t<iterator_t<R>>;
0048 template<range R>
0049 using range_reference_t = iter_reference_t<iterator_t<R>>;
0050 template<range R>
0051 using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
0052 template <range R>
0053 using range_common_reference_t = iter_common_reference_t<iterator_t<R>>;
0054
0055 // [range.sized], sized ranges
0056 template<class>
0057 inline constexpr bool disable_sized_range = false;
0058
0059 template<class T>
0060 concept sized_range = ...;
0061
0062 // [range.view], views
0063 template<class T>
0064 inline constexpr bool enable_view = ...;
0065
0066 struct view_base { };
0067
0068 template<class T>
0069 concept view = ...;
0070
0071 // [range.refinements], other range refinements
0072 template<class R, class T>
0073 concept output_range = see below;
0074
0075 template<class T>
0076 concept input_range = see below;
0077
0078 template<class T>
0079 concept forward_range = see below;
0080
0081 template<class T>
0082 concept bidirectional_range = see below;
0083
0084 template<class T>
0085 concept random_access_range = see below;
0086
0087 template<class T>
0088 concept contiguous_range = see below;
0089
0090 template <class _Tp>
0091 concept common_range = see below;
0092
0093 template<class T>
0094 concept viewable_range = see below;
0095
0096 // [range.adaptor.object], range adaptor objects
0097 template<class D>
0098 requires is_class_v<D> && same_as<D, remove_cv_t<D>>
0099 class range_adaptor_closure { }; // Since c++23
0100
0101 // [view.interface], class template view_interface
0102 template<class D>
0103 requires is_class_v<D> && same_as<D, remove_cv_t<D>>
0104 class view_interface;
0105
0106 // [range.subrange], sub-ranges
0107 enum class subrange_kind : bool { unsized, sized };
0108
0109 template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K = see below>
0110 requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
0111 class subrange;
0112
0113 template<class I, class S, subrange_kind K>
0114 inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true;
0115
0116 // [range.dangling], dangling iterator handling
0117 struct dangling;
0118
0119 template<range R>
0120 using borrowed_iterator_t = see below;
0121
0122 template<range R>
0123 using borrowed_subrange_t = see below;
0124
0125 // [range.elements], elements view
0126 template<input_range V, size_t N>
0127 requires see below
0128 class elements_view;
0129
0130 template<class T, size_t N>
0131 inline constexpr bool enable_borrowed_range<elements_view<T, N>> =
0132 enable_borrowed_range<T>;
0133
0134 template<class R>
0135 using keys_view = elements_view<R, 0>;
0136 template<class R>
0137 using values_view = elements_view<R, 1>;
0138
0139 namespace views {
0140 template<size_t N>
0141 inline constexpr unspecified elements = unspecified;
0142 inline constexpr auto keys = elements<0>;
0143 inline constexpr auto values = elements<1>;
0144 }
0145
0146 // [range.utility.conv], range conversions
0147 template<class C, input_range R, class... Args> requires (!view<C>)
0148 constexpr C to(R&& r, Args&&... args); // Since C++23
0149 template<template<class...> class C, input_range R, class... Args>
0150 constexpr auto to(R&& r, Args&&... args); // Since C++23
0151 template<class C, class... Args> requires (!view<C>)
0152 constexpr auto to(Args&&... args); // Since C++23
0153 template<template<class...> class C, class... Args>
0154 constexpr auto to(Args&&... args); // Since C++23
0155
0156 // [range.empty], empty view
0157 template<class T>
0158 requires is_object_v<T>
0159 class empty_view;
0160
0161 template<class T>
0162 inline constexpr bool enable_borrowed_range<empty_view<T>> = true;
0163
0164 namespace views {
0165 template<class T>
0166 inline constexpr empty_view<T> empty{};
0167 }
0168
0169 // [range.all], all view
0170 namespace views {
0171 inline constexpr unspecified all = unspecified;
0172
0173 template<viewable_range R>
0174 using all_t = decltype(all(declval<R>()));
0175 }
0176
0177 template<range R>
0178 requires is_object_v<R>
0179 class ref_view;
0180
0181 template<class T>
0182 inline constexpr bool enable_borrowed_range<ref_view<T>> = true;
0183
0184 template<range R>
0185 requires see below
0186 class owning_view;
0187
0188 template<class T>
0189 inline constexpr bool enable_borrowed_range<owning_view<T>> = enable_borrowed_range<T>;
0190
0191 // [range.filter], filter view
0192 template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
0193 requires view<V> && is_object_v<Pred>
0194 class filter_view;
0195
0196 namespace views {
0197 inline constexpr unspecified filter = unspecified;
0198 }
0199
0200 // [range.drop], drop view
0201 template<view V>
0202 class drop_view;
0203
0204 template<class T>
0205 inline constexpr bool enable_borrowed_range<drop_view<T>> = enable_borrowed_range<T>;
0206
0207 // [range.drop.while], drop while view
0208 template<view V, class Pred>
0209 requires input_range<V> && is_object_v<Pred> &&
0210 indirect_unary_predicate<const Pred, iterator_t<V>>
0211 class drop_while_view;
0212
0213 template<class T, class Pred>
0214 inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =
0215 enable_borrowed_range<T>;
0216
0217 namespace views { inline constexpr unspecified drop_while = unspecified; }
0218
0219 // [range.transform], transform view
0220 template<input_range V, copy_constructible F>
0221 requires view<V> && is_object_v<F> &&
0222 regular_invocable<F&, range_reference_t<V>> &&
0223 can-reference<invoke_result_t<F&, range_reference_t<V>>>
0224 class transform_view;
0225
0226 // [range.counted], counted view
0227 namespace views { inline constexpr unspecified counted = unspecified; }
0228
0229 // [range.common], common view
0230 template<view V>
0231 requires (!common_range<V> && copyable<iterator_t<V>>)
0232 class common_view;
0233
0234 // [range.reverse], reverse view
0235 template<view V>
0236 requires bidirectional_range<V>
0237 class reverse_view;
0238
0239 template<class T>
0240 inline constexpr bool enable_borrowed_range<reverse_view<T>> = enable_borrowed_range<T>;
0241
0242 template<class T>
0243 inline constexpr bool enable_borrowed_range<common_view<T>> = enable_borrowed_range<T>;
0244
0245 // [range.take], take view
0246 template<view> class take_view;
0247
0248 template<class T>
0249 inline constexpr bool enable_borrowed_range<take_view<T>> = enable_borrowed_range<T>;
0250
0251 // [range.take.while], take while view
0252 template<view V, class Pred>
0253 requires input_range<V> && is_object_v<Pred> &&
0254 indirect_unary_predicate<const Pred, iterator_t<V>>
0255 class take_while_view;
0256
0257 namespace views { inline constexpr unspecified take_while = unspecified; }
0258
0259 template<copy_constructible T>
0260 requires is_object_v<T>
0261 class single_view;
0262
0263 template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
0264 requires weakly-equality-comparable-with<W, Bound> && copyable<W>
0265 class iota_view;
0266
0267 template<class W, class Bound>
0268 inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
0269
0270 // [range.repeat], repeat view
0271 template<class T>
0272 concept integer-like-with-usable-difference-type = // exposition only
0273 is-signed-integer-like<T> || (is-integer-like<T> && weakly_incrementable<T>);
0274
0275 template<move_constructible T, semiregular Bound = unreachable_sentinel_t>
0276 requires (is_object_v<T> && same_as<T, remove_cv_t<T>> &&
0277 (integer-like-with-usable-difference-type<Bound> ||
0278 same_as<Bound, unreachable_sentinel_t>))
0279 class repeat_view;
0280
0281 namespace views { inline constexpr unspecified repeat = unspecified; }
0282
0283 // [range.join], join view
0284 template<input_range V>
0285 requires view<V> && input_range<range_reference_t<V>>
0286 class join_view;
0287
0288 // [range.lazy.split], lazy split view
0289 template<class R>
0290 concept tiny-range = see below; // exposition only
0291
0292 template<input_range V, forward_range Pattern>
0293 requires view<V> && view<Pattern> &&
0294 indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to> &&
0295 (forward_range<V> || tiny-range<Pattern>)
0296 class lazy_split_view;
0297
0298 // [range.split], split view
0299 template<forward_range V, forward_range Pattern>
0300 requires view<V> && view<Pattern> &&
0301 indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
0302 class split_view;
0303
0304 namespace views {
0305 inline constexpr unspecified lazy_split = unspecified;
0306 inline constexpr unspecified split = unspecified;
0307 }
0308
0309 // [range.istream], istream view
0310 template<movable Val, class CharT, class Traits = char_traits<CharT>>
0311 requires see below
0312 class basic_istream_view;
0313
0314 template<class Val>
0315 using istream_view = basic_istream_view<Val, char>;
0316
0317 template<class Val>
0318 using wistream_view = basic_istream_view<Val, wchar_t>;
0319
0320 namespace views { template<class T> inline constexpr unspecified istream = unspecified; }
0321
0322 // [range.zip], zip view
0323 template<input_range... Views>
0324 requires (view<Views> && ...) && (sizeof...(Views) > 0)
0325 class zip_view; // C++23
0326
0327 template<class... Views>
0328 inline constexpr bool enable_borrowed_range<zip_view<Views...>> = // C++23
0329 (enable_borrowed_range<Views> && ...);
0330
0331 namespace views { inline constexpr unspecified zip = unspecified; } // C++23
0332
0333 // [range.as.rvalue]
0334 template <view V>
0335 requires input_range<V>
0336 class as_rvalue_view; // C++23
0337
0338 namespace views { inline constexpr unspecified as_rvalue ) unspecified; } // C++23
0339
0340 [range.chunk.by]
0341 template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
0342 requires view<V> && is_object_v<Pred>
0343 class chunk_by_view; // C++23
0344
0345 namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23
0346 }
0347
0348 namespace std {
0349 namespace views = ranges::views;
0350
0351 template<class T> struct tuple_size;
0352 template<size_t I, class T> struct tuple_element;
0353
0354 template<class I, class S, ranges::subrange_kind K>
0355 struct tuple_size<ranges::subrange<I, S, K>>
0356 : integral_constant<size_t, 2> {};
0357
0358 template<class I, class S, ranges::subrange_kind K>
0359 struct tuple_element<0, ranges::subrange<I, S, K>> {
0360 using type = I;
0361 };
0362
0363 template<class I, class S, ranges::subrange_kind K>
0364 struct tuple_element<1, ranges::subrange<I, S, K>> {
0365 using type = S;
0366 };
0367
0368 template<class I, class S, ranges::subrange_kind K>
0369 struct tuple_element<0, const ranges::subrange<I, S, K>> {
0370 using type = I;
0371 };
0372
0373 template<class I, class S, ranges::subrange_kind K>
0374 struct tuple_element<1, const ranges::subrange<I, S, K>> {
0375 using type = S;
0376 };
0377
0378 struct from_range_t { explicit from_range_t() = default; }; // Since C++23
0379 inline constexpr from_range_t from_range{}; // Since C++23
0380 }
0381 */
0382
0383 #include <__cxx03/__config>
0384
0385 #if _LIBCPP_STD_VER >= 20
0386 # include <__cxx03/__ranges/access.h>
0387 # include <__cxx03/__ranges/all.h>
0388 # include <__cxx03/__ranges/common_view.h>
0389 # include <__cxx03/__ranges/concepts.h>
0390 # include <__cxx03/__ranges/counted.h>
0391 # include <__cxx03/__ranges/dangling.h>
0392 # include <__cxx03/__ranges/data.h>
0393 # include <__cxx03/__ranges/drop_view.h>
0394 # include <__cxx03/__ranges/drop_while_view.h>
0395 # include <__cxx03/__ranges/elements_view.h>
0396 # include <__cxx03/__ranges/empty.h>
0397 # include <__cxx03/__ranges/empty_view.h>
0398 # include <__cxx03/__ranges/enable_borrowed_range.h>
0399 # include <__cxx03/__ranges/enable_view.h>
0400 # include <__cxx03/__ranges/filter_view.h>
0401 # include <__cxx03/__ranges/iota_view.h>
0402 # include <__cxx03/__ranges/join_view.h>
0403 # include <__cxx03/__ranges/lazy_split_view.h>
0404 # include <__cxx03/__ranges/rbegin.h>
0405 # include <__cxx03/__ranges/ref_view.h>
0406 # include <__cxx03/__ranges/rend.h>
0407 # include <__cxx03/__ranges/reverse_view.h>
0408 # include <__cxx03/__ranges/single_view.h>
0409 # include <__cxx03/__ranges/size.h>
0410 # include <__cxx03/__ranges/split_view.h>
0411 # include <__cxx03/__ranges/subrange.h>
0412 # include <__cxx03/__ranges/take_view.h>
0413 # include <__cxx03/__ranges/take_while_view.h>
0414 # include <__cxx03/__ranges/transform_view.h>
0415 # include <__cxx03/__ranges/view_interface.h>
0416 # include <__cxx03/__ranges/views.h>
0417
0418 # if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
0419 # include <__cxx03/__ranges/istream_view.h>
0420 # endif
0421 #endif
0422
0423 #if _LIBCPP_STD_VER >= 23
0424 # include <__cxx03/__ranges/as_rvalue_view.h>
0425 # include <__cxx03/__ranges/chunk_by_view.h>
0426 # include <__cxx03/__ranges/from_range.h>
0427 # include <__cxx03/__ranges/repeat_view.h>
0428 # include <__cxx03/__ranges/to.h>
0429 # include <__cxx03/__ranges/zip_view.h>
0430 #endif
0431
0432 #include <__cxx03/version>
0433
0434 // standard-mandated includes
0435
0436 // [ranges.syn]
0437 #include <__cxx03/compare>
0438 #include <__cxx03/initializer_list>
0439 #include <__cxx03/iterator>
0440
0441 // [tuple.helper]
0442 #include <__cxx03/__tuple/tuple_element.h>
0443 #include <__cxx03/__tuple/tuple_size.h>
0444
0445 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0446 # pragma GCC system_header
0447 #endif
0448
0449 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
0450 # include <__cxx03/cstddef>
0451 # include <__cxx03/limits>
0452 # include <__cxx03/optional>
0453 # include <__cxx03/span>
0454 # include <__cxx03/tuple>
0455 #endif
0456
0457 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0458 # include <__cxx03/cstdlib>
0459 # include <__cxx03/iosfwd>
0460 # include <__cxx03/type_traits>
0461 #endif
0462
0463 #endif // _LIBCPP___CXX03_RANGES