// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_RANGES #define _LIBCPP_RANGES /* #include // see [compare.syn] #include // see [initializer.list.syn] #include // see [iterator.synopsis] namespace std::ranges { inline namespace unspecified { // [range.access], range access inline constexpr unspecified begin = unspecified; inline constexpr unspecified end = unspecified; inline constexpr unspecified cbegin = unspecified; inline constexpr unspecified cend = unspecified; inline constexpr unspecified size = unspecified; inline constexpr unspecified ssize = unspecified; } // [range.range], ranges template concept range = see below; template inline constexpr bool enable_borrowed_range = false; template using iterator_t = decltype(ranges::begin(declval())); template using sentinel_t = decltype(ranges::end(declval())); template using range_difference_t = iter_difference_t>; template using range_size_t = decltype(ranges::size(declval())); template using range_value_t = iter_value_t>; template using range_reference_t = iter_reference_t>; template using range_rvalue_reference_t = iter_rvalue_reference_t>; template using range_common_reference_t = iter_common_reference_t>; // [range.sized], sized ranges template inline constexpr bool disable_sized_range = false; template concept sized_range = ...; // [range.view], views template inline constexpr bool enable_view = ...; struct view_base { }; template concept view = ...; // [range.refinements], other range refinements template concept output_range = see below; template concept input_range = see below; template concept forward_range = see below; template concept bidirectional_range = see below; template concept random_access_range = see below; template concept contiguous_range = see below; template concept common_range = see below; template concept viewable_range = see below; // [view.interface], class template view_interface template requires is_class_v && same_as> class view_interface; // [range.subrange], sub-ranges enum class subrange_kind : bool { unsized, sized }; template S = I, subrange_kind K = see below> requires (K == subrange_kind::sized || !sized_sentinel_for) class subrange; template inline constexpr bool enable_borrowed_range> = true; // [range.dangling], dangling iterator handling struct dangling; template using borrowed_iterator_t = see below; template using borrowed_subrange_t = see below; // [range.elements], elements view template requires see below class elements_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; template using keys_view = elements_view; template using values_view = elements_view; namespace views { template inline constexpr unspecified elements = unspecified; inline constexpr auto keys = elements<0>; inline constexpr auto values = elements<1>; } // [range.utility.conv], range conversions template requires (!view) constexpr C to(R&& r, Args&&... args); // Since C++23 template class C, input_range R, class... Args> constexpr auto to(R&& r, Args&&... args); // Since C++23 template requires (!view) constexpr auto to(Args&&... args); // Since C++23 template class C, class... Args> constexpr auto to(Args&&... args); // Since C++23 // [range.empty], empty view template requires is_object_v class empty_view; template inline constexpr bool enable_borrowed_range> = true; namespace views { template inline constexpr empty_view empty{}; } // [range.all], all view namespace views { inline constexpr unspecified all = unspecified; template using all_t = decltype(all(declval())); } template requires is_object_v class ref_view; template inline constexpr bool enable_borrowed_range> = true; template requires see below class owning_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; // [range.filter], filter view template> Pred> requires view && is_object_v class filter_view; namespace views { inline constexpr unspecified filter = unspecified; } // [range.drop], drop view template class drop_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; // [range.drop.while], drop while view template requires input_range && is_object_v && indirect_unary_predicate> class drop_while_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; namespace views { inline constexpr unspecified drop_while = unspecified; } // [range.transform], transform view template requires view && is_object_v && regular_invocable> && can-reference>> class transform_view; // [range.counted], counted view namespace views { inline constexpr unspecified counted = unspecified; } // [range.common], common view template requires (!common_range && copyable>) class common_view; // [range.reverse], reverse view template requires bidirectional_range class reverse_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; // [range.take], take view template class take_view; template inline constexpr bool enable_borrowed_range> = enable_borrowed_range; // [range.take.while], take while view template requires input_range && is_object_v && indirect_unary_predicate> class take_while_view; namespace views { inline constexpr unspecified take_while = unspecified; } template requires is_object_v class single_view; template requires weakly-equality-comparable-with && copyable class iota_view; template inline constexpr bool enable_borrowed_range> = true; // [range.repeat], repeat view template concept integer-like-with-usable-difference-type = // exposition only is-signed-integer-like || (is-integer-like && weakly_incrementable); template requires (is_object_v && same_as> && (integer-like-with-usable-difference-type || same_as)) class repeat_view; namespace views { inline constexpr unspecified repeat = unspecified; } // [range.join], join view template requires view && input_range> class join_view; // [range.lazy.split], lazy split view template concept tiny-range = see below; // exposition only template requires view && view && indirectly_comparable, iterator_t, ranges::equal_to> && (forward_range || tiny-range) class lazy_split_view; // [range.split], split view template requires view && view && indirectly_comparable, iterator_t, ranges::equal_to> class split_view; namespace views { inline constexpr unspecified lazy_split = unspecified; inline constexpr unspecified split = unspecified; } // [range.istream], istream view template> requires see below class basic_istream_view; template using istream_view = basic_istream_view; template using wistream_view = basic_istream_view; namespace views { template inline constexpr unspecified istream = unspecified; } // [range.zip], zip view template requires (view && ...) && (sizeof...(Views) > 0) class zip_view; // C++23 template inline constexpr bool enable_borrowed_range> = // C++23 (enable_borrowed_range && ...); namespace views { inline constexpr unspecified zip = unspecified; } // C++23 // [range.as.rvalue] template requires input_range class as_rvalue_view; // C++23 namespace views { inline constexpr unspecified as_rvalue ) unspecified; } // C++23 [range.chunk.by] template, iterator_t> Pred> requires view && is_object_v class chunk_by_view; // C++23 namespace views { inline constexpr unspecified chunk_by = unspecified; } // C++23 } namespace std { namespace views = ranges::views; template struct tuple_size; template struct tuple_element; template struct tuple_size> : integral_constant {}; template struct tuple_element<0, ranges::subrange> { using type = I; }; template struct tuple_element<1, ranges::subrange> { using type = S; }; template struct tuple_element<0, const ranges::subrange> { using type = I; }; template struct tuple_element<1, const ranges::subrange> { using type = S; }; struct from_range_t { explicit from_range_t() = default; }; // Since C++23 inline constexpr from_range_t from_range{}; // Since C++23 } */ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__ranges/access.h> #include <__ranges/all.h> #include <__ranges/as_rvalue_view.h> #include <__ranges/chunk_by_view.h> #include <__ranges/common_view.h> #include <__ranges/concepts.h> #include <__ranges/counted.h> #include <__ranges/dangling.h> #include <__ranges/data.h> #include <__ranges/drop_view.h> #include <__ranges/drop_while_view.h> #include <__ranges/elements_view.h> #include <__ranges/empty.h> #include <__ranges/empty_view.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/filter_view.h> #include <__ranges/from_range.h> #include <__ranges/iota_view.h> #include <__ranges/join_view.h> #include <__ranges/lazy_split_view.h> #include <__ranges/rbegin.h> #include <__ranges/ref_view.h> #include <__ranges/rend.h> #include <__ranges/repeat_view.h> #include <__ranges/reverse_view.h> #include <__ranges/single_view.h> #include <__ranges/size.h> #include <__ranges/split_view.h> #include <__ranges/subrange.h> #include <__ranges/take_view.h> #include <__ranges/take_while_view.h> #include <__ranges/to.h> #include <__ranges/transform_view.h> #include <__ranges/view_interface.h> #include <__ranges/views.h> #include <__ranges/zip_view.h> #include #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include <__ranges/istream_view.h> #endif // standard-mandated includes // [ranges.syn] #include #include #include // [tuple.helper] #include <__tuple/tuple_element.h> #include <__tuple/tuple_size.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # include # include #endif #endif // _LIBCPP_RANGES