标准库标头 <ranges>

来自cppreference.com
< cpp‎ | header
 
 
标准库标头
注:修订记号中的反斜杠 '/' 意味着此标头被弃用和/或被移除。
语言支持
概念
<concepts> (C++20)
诊断
<system_error> (C++11)
内存管理
<memory_resource> (C++17)  
元编程
<type_traits> (C++11)
<ratio> (C++11)
通用工具
<utility>
<tuple> (C++11)
<optional> (C++17)
<variant> (C++17)
<any> (C++17)
<expected> (C++23)
<bitset>

<charconv> (C++17)
<format> (C++20)
<bit> (C++20)

字符串
<cuchar> (C++11)

容器
<flat_set> (C++23)
<span> (C++20)
<mdspan> (C++23)

迭代器
<iterator>
范围
<ranges> (C++20)
<generator> (C++23)
算法
数值
<cfenv> (C++11)
<complex>
<numbers> (C++20)

日期时间
<chrono> (C++11)
本地化
<codecvt> (C++11/17)
输入/输出
<filesystem> (C++17)
<cstdio>
<cinttypes> (C++11)
<strstream> (C++98/)
正则表达式
<regex>
并发支持
<stop_token> (C++20)
<thread> (C++11)
<atomic> (C++11)
<stdatomic.h> (C++23)
<mutex> (C++11)
<shared_mutex> (C++14)
<condition_variable> (C++11)  
<semaphore> (C++20)
<latch> (C++20)
<barrier> (C++20)
<future> (C++11)

C 兼容
<cstdbool> (C++11/17/20)  
<ccomplex> (C++11/17/20)
<ctgmath> (C++11/17/20)

<cstdalign> (C++11/17/20)

<ciso646> (C++20 前)

 

此头文件是范围库的一部分。

命名空间别名

namespace std {

    namespace views = ranges::views;

}

提供命名空间别名 std::views,作为 std::ranges::views 的简称。

概念

范围概念
在命名空间 std::ranges 定义
指定类型为范围,即它同时提供 begin 迭代器和 end 哨位
(概念)
指定类型为 range 而且能安全返回从该类型表达式获得的迭代器而无悬垂之虞
(概念)
指定类型为可在常数时间内知晓大小的范围
(概念)
指定范围为视图,即它拥有常数时间的复制/移动/赋值
(概念)
指定范围的迭代器类型满足 input_iterator
(概念)
指定范围的迭代器类型满足 output_iterator
(概念)
指定范围的迭代器类型满足 forward_iterator
(概念)
指定范围的迭代器类型满足 bidirectional_iterator
(概念)
指定范围的迭代器类型满足 random_access_iterator
(概念)
指定范围的迭代器类型满足 contiguous_iterator
(概念)
指定范围拥有相同的迭代器和哨位类型
(概念)
指定针对 range 的要求,令其可安全转换为 view
(概念)
指定范围的所有元素只读
(概念)

函数

范围转换器
在命名空间 std::ranges 定义
从另一范围构造一个非视图范围
(函数模板)

范围原语
在命名空间 std::ranges 定义
获取关联的范围类型
(别名模板)
视图
在命名空间 std::ranges 定义
用于定义 view 的辅助类模板,使用奇特重现模板模式
(类模板)
将迭代器/哨位对结合为一个 view
(类模板)
悬垂迭代器处理
在命名空间 std::ranges 定义
占位类型,指示不应返回迭代器或子范围,因为它可能悬垂
(类)
获得塑造 borrowed_range 的迭代器类型或子范围类型
(别名模板)
范围适配器对象工具
在命名空间 std::ranges 定义
用于定义范围适配器闭包对象的辅助基类模板
(类模板)
工厂
在命名空间 std::ranges 定义
无元素的空 view
(类模板) (变量模板)
含有具有指定值的单个元素的 view
(类模板) (定制点对象)
由通过重复对某个初值自增所生成的序列组成的 view
(类模板) (定制点对象)
由在关联的输入流上相继应用 operator>> 获得的元素组成的 view
(类模板) (定制点对象)
由重复产出同一值生成的序列组成的 view
(类模板) (定制点对象)
n 元笛卡尔积计算后的的元组组成的 view
(类模板) (定制点对象)
适配器
在命名空间 std::ranges 定义
包含 range 的所有元素的 view
(别名模板) (范围适配器对象)
某个其他 range 的元素的 view
(类模板)
拥有某 range 的独占所有权的 view
(类模板)
range 中满足某个谓词的元素构成的 view
(类模板) (范围适配器对象)
对序列的每个元素应用某个变换函数的 view
(类模板) (范围适配器对象)
由另一 view 的前 N 个元素组成的 view
(类模板) (范围适配器对象)
由另一 view 的到首个谓词返回 false 为止的起始元素组成的 view
(类模板) (范围适配器对象)
由另一 view 跳过首 N 个元素组成的 view
(类模板) (范围适配器对象)
由另一 view 跳过元素的起始序列,直至首个谓词返回 false 的元素组成的 view
(类模板) (范围适配器对象)
由拉平 range 组成的 view 所获得的序列构成的 view
(类模板) (范围适配器对象)
用某个分隔符切割另一 view 所获得的子范围的 view
(类模板) (范围适配器对象)
用某个分隔符切割另一 view 所获得的子范围的 view
(类模板) (范围适配器对象)
从迭代器和计数创建子范围
(定制点对象)
转换 viewcommon_range
(类模板) (范围适配器对象)
以逆序迭代另一双向视图上的元素的 view
(类模板) (范围适配器对象)
转换 viewconstant_range
(类模板) (范围适配器对象)
由将序列所有元素转换为右值组成的 view
(类模板) (范围适配器对象)
选取 tuple-like 值组成的 view 和数值 N,产生每个 tuple 的第 N 个元素的 view
(类模板) (范围适配器对象)
选取 pair 式值组成的 view 并产生每个 pair 的第一元素的 view
(类模板) (范围适配器对象)
选取 pair 式值组成的 view 并产生每个 pair 的第二元素的 view
(类模板) (范围适配器对象)
到被适配视图的对应元素的位置和他的值组成的元组的 view
(类模板) (范围适配器对象)
到被适配视图的对应元素的引用元组组成的 view
(类模板) (定制点对象)
由应用变换函数到被适配视图的对应元素的结果的元组组成的 view
(类模板) (定制点对象)
由到被适配视图的相邻元素的引用的元组组成的 view
(类模板) (范围适配器对象)
由应用变换函数到被适配视图的相邻元素的结果的元组组成的 view
(类模板) (范围适配器对象)
由拉平范围组成的视图并以分隔符间隔所获得的序列构成的 view
(类模板) (范围适配器对象)
由另一 view 的元素每次前进 N 步所获得的 view
(类模板) (范围适配器对象)
第 M 个元素是另一 view 从第 M 到第 (M + N - 1) 个元素的 view 构成的 view
(类模板) (范围适配器对象)
另一个视图元素的 N 大小不重叠的连续块组成的 view 的范围
(类模板) (范围适配器对象)
当给定的谓词返回 false 的时候,将 view 分割成每一对临近元素的子范围
(类模板) (范围适配器对象)

定制点对象

范围访问
在命名空间 std::ranges 定义
返回指向范围起始的迭代器
(定制点对象)
返回指示范围结尾的哨位
(定制点对象)
返回指向只读范围起始的迭代器
(定制点对象)
返回指示只读范围结尾的哨位
(定制点对象)
返回指向范围的逆向迭代器
(定制点对象)
返回指向范围的逆向尾迭代器
(定制点对象)
返回指向只读范围的逆向迭代器
(定制点对象)
返回指向只读范围的逆向尾迭代器
(定制点对象)
返回等于范围大小的整数
(定制点对象)
返回等于范围大小的有符号整数
(定制点对象)
检查范围是否为空
(定制点对象)
获得指向连续范围的起始的指针
(定制点对象)
获得指向只读连续范围的起始的指针
(定制点对象)

枚举

在命名空间 std::ranges 定义
指定 std::ranges::subrange 是否实现 std::ranges::sized_range
(枚举)

辅助工具

获得 std::ranges::subrange 的组分数量
(类模板特化)
获得 std::ranges::subrange 的迭代器或哨位的类型
(类模板特化)
指定来自范围的消歧义标签
(类) (常量)

概要

#include <compare>
#include <initializer_list>
#include <iterator>
 
namespace std::ranges {
  inline namespace /* 未指定 */ {
    // 范围访问
    inline constexpr /* 未指定 */ begin =   /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ end =     /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ cbegin =  /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ cend =    /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ rbegin =  /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ rend =    /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ crbegin = /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ crend =   /* 未指定 */;     // 独立实现
 
    inline constexpr /* 未指定 */ size =    /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ ssize =   /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ empty =   /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ data =    /* 未指定 */;     // 独立实现
    inline constexpr /* 未指定 */ cdata =   /* 未指定 */;     // 独立实现
  }
 
  // 范围
  template<class T>
    concept range = /* 见描述 */;                                        // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range = false;                // 独立实现
 
  template<class T>
    concept borrowed_range = /* 见描述 */;                               // 独立实现
 
  template<class T>
    using iterator_t = decltype(ranges::begin(declval<T&>()));          // 独立实现
  template<range R>
    using sentinel_t = decltype(ranges::end(declval<R&>()));            // 独立实现
  template<range R>
    using const_iterator_t = const_iterator<iterator_t<R>>;             // 独立实现
  template<range R>
    using range_difference_t = iter_difference_t<iterator_t<R>>;        // 独立实现
  template<sized_range R>
    using range_size_t = decltype(ranges::size(declval<R&>()));         // 独立实现
  template<range R>
    using range_value_t = iter_value_t<iterator_t<R>>;                  // 独立实现
  template<range R>
    using range_reference_t = iter_reference_t<iterator_t<R>>;          // 独立实现
  template<range R>
    using range_const_reference_t = iter_const_reference_t<iterator_t<R>>;
                                                                        // 独立实现
  template<range R>
    using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>;
                                                                        // 独立实现
  template<range R>
    using range_common_reference_t = iter_common_reference_t<iterator_t<R>>;
                                                                        // 独立实现
 
  // 有界范围
  template<class>
    inline constexpr bool disable_sized_range = false;                  // 独立实现
 
  template<class T>
    concept sized_range = /* 见描述 */;                                  // 独立实现
 
  // 视图
  template<class T>
    inline constexpr bool enable_view = /* 见描述 */;                    // 独立实现
 
  struct view_base {};                                                  // 独立实现
 
  template<class T>
    concept view = /* 见描述 */;                                         // 独立实现
 
  // 其他加细范围
  template<class R, class T>
    concept output_range = /* 见描述 */;                                 // 独立实现
 
  template<class T>
    concept input_range = /* 见描述 */;                                  // 独立实现
 
  template<class T>
    concept forward_range = /* 见描述 */;                                // 独立实现
 
  template<class T>
    concept bidirectional_range = /* 见描述 */;                          // 独立实现
 
  template<class T>
    concept random_access_range = /* 见描述 */;                          // 独立实现
 
  template<class T>
    concept contiguous_range = /* 见描述 */;                             // 独立实现
 
  template<class T>
    concept common_range = /* 见描述 */;                                 // 独立实现
 
  template<class T>
    concept viewable_range = /* 见描述 */;                               // 独立实现
 
  template<class T>
    concept constant_range = /* 见描述 */;                               // 独立实现
 
  // 类模板 view_interface
  template<class D>
    requires is_class_v<D> && same_as<D, remove_cv_t<D>>
  class view_interface;                                                 // 独立实现
 
  // 子范围
  enum class subrange_kind : bool { unsized, sized };                   // 独立实现
 
  template<input_or_output_iterator I, sentinel_for<I> S = I,
      subrange_kind K = /* 见描述 */>
    requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
  class subrange;                                                       // 独立实现
 
  template<class I, class S, subrange_kind K>
    inline constexpr bool enable_borrowed_range<subrange<I, S, K>> = true; 
                                                                        // 独立实现
 
  template<size_t N, class I, class S, subrange_kind K>
    requires ((N == 0 && copyable<I>) || N == 1)
    constexpr auto get(const subrange<I, S, K>& r);                     // 独立实现
 
  template<size_t N, class I, class S, subrange_kind K>
    requires (N < 2)
    constexpr auto get(subrange<I, S, K>&& r);                          // 独立实现
}
 
namespace std {
  using ranges::get;                                                    // 独立实现
}
 
namespace std::ranges {
  // 悬垂迭代器处理
  struct dangling;                                                      // 独立实现
 
  // 类模板 elements_of
  template<range R, class Allocator = allocator<byte>>
    struct elements_of;
 
  template<range R>
    using borrowed_iterator_t = /* 见描述 */;                  // 独立实现
 
  template<range R>
    using borrowed_subrange_t = /* 见描述 */;                  // 独立实现
 
  // 范围转换器
  template<class C, input_range R, class... Args> requires (!view<C>)
    constexpr C to(R&& r, Args&&... args);                              // 独立实现
  template<template<class...> class C, input_range R, class... Args>
    constexpr auto to(R&& r, Args&&... args);                           // 独立实现
  template<class C, class... Args> requires (!view<C>)
    constexpr auto to(Args&&... args);                                  // 独立实现
  template<template<class...> class C, class... Args>
    constexpr auto to(Args&&... args);                                  // 独立实现
 
  // empty view
  template<class T>
    requires is_object_v<T>
  class empty_view;                                                     // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<empty_view<T>> = true;  // 独立实现
 
  namespace views {
    template<class T>
      inline constexpr empty_view<T> empty{};                           // 独立实现
  }
 
  // single view
  template<move_constructible T>
    requires is_object_v<T>
  class single_view;                                                    // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ single = /* 未指定 */; }
                                                                        // 独立实现
 
  template<bool Const, class T>
    using __maybe_const = conditional_t<Const, const T, T>;   // 仅用于阐释
 
  // iota view
  template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
    requires __weakly_equality_comparable_with<W, Bound> && copyable<W>
  class iota_view;                                                      // 独立实现
 
  template<class W, class Bound>
    inline constexpr bool enable_borrowed_range<iota_view<W, Bound>> = true;
                                                                        // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ iota = /* 未指定 */; }
                                                                        // 独立实现
 
  // repeat view
  template<move_constructible W, semiregular Bound = unreachable_sentinel_t>
    requires (is_object_v<W> && same_as<W, remove_cv_t<W>>
      && (__is_integer_like<Bound> || same_as<Bound, unreachable_sentinel_t>))
  class repeat_view;
 
  namespace views { inline constexpr /* 未指定 */ repeat = /* 未指定 */; }
 
  // istream view
  template<movable Val, class CharT, class Traits = char_traits<CharT>>
    requires /* 见描述 */
  class basic_istream_view;
  template<class Val>
    using istream_view = basic_istream_view<Val, char>;
  template<class Val>
    using wistream_view = basic_istream_view<Val, wchar_t>;
 
  namespace views { template<class T> inline constexpr /* 未指定 */ istream =
    /* 未指定 */; }
 
  // range adaptor objects
  template<class D>
    requires is_class_v<D> && same_as<D, remove_cv_t<D>>
  class range_adaptor_closure { };                                      // 独立实现
 
  // all view
  namespace views {
    inline constexpr /* 未指定 */ all = /* 未指定 */;         // 独立实现
 
    template<viewable_range R>
      using all_t = decltype(all(declval<R>()));                        // 独立实现
  }
 
  // ref view
  template<range R>
    requires is_object_v<R>
  class ref_view;                                                       // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<ref_view<T>> = true;    // 独立实现
 
  // owning view
  template<range R>
    requires /* 见描述 */
  class owning_view;                                                    // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<owning_view<T>> =       // 独立实现
      enable_borrowed_range<T>;
 
  // as rvalue view
  template<view V>
    requires input_range<V>
  class as_rvalue_view;                                                 // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<as_rvalue_view<T>> =    // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ as_rvalue = /* 未指定 */; }
                                                                        // 独立实现
 
  // filter view
  template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class filter_view;                                                    // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ filter = /* 未指定 */; }
                                                                        // 独立实现
 
  // transform view
  template<input_range V, move_constructible F>
    requires view<V> && is_object_v<F> &&
             regular_invocable<F&, range_reference_t<V>> &&
             __can_reference<invoke_result_t<F&, range_reference_t<V>>>
  class transform_view;                                                 // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ transform = /* 未指定 */; }
                                                                        // 独立实现
 
  // take view
  template<view> class take_view;                                       // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<take_view<T>> =         // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ take = /* 未指定 */; }
                                                                        // 独立实现
 
  // take while view
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> &&
             indirect_unary_predicate<const Pred, iterator_t<V>>
    class take_while_view;                                              // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ take_while = /* 未指定 */; }
                                                                        // 独立实现
 
  // drop view
  template<view V>
    class drop_view;                                                    // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<drop_view<T>> =         // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ drop = /* 未指定 */; }
                                                                        // 独立实现
 
  // drop while view
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> &&
             indirect_unary_predicate<const Pred, iterator_t<V>>
    class drop_while_view;                                              // 独立实现
 
  template<class T, class Pred>
    inline constexpr bool enable_borrowed_range<drop_while_view<T, Pred>> =
                                                                        // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ drop_while = /* 未指定 */; }
                                                                        // 独立实现
 
  // join view
  template<input_range V>
    requires view<V> && input_range<range_reference_t<V>>
  class join_view;                                                      // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ join = /* 未指定 */; }
                                                                        // 独立实现
 
  // join with view
  template<class R, class P>
    concept __compatible_joinable_ranges = /* 见描述 */; // 仅用于阐释
 
  template<input_range V, forward_range Pattern>
    requires view<V> && input_range<range_reference_t<V>>
          && view<Pattern>
          && __compatible_joinable_ranges<range_reference_t<V>, Pattern>
  class join_with_view;                                                 // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ join_with = /* 未指定 */; }
                                                                        // 独立实现
 
  // lazy split view
  template<class R>
    concept __tiny_range = /* 见描述 */;   // 仅用于阐释
 
  template<input_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>,
             ranges::equal_to> &&
             (forward_range<V> || __tiny_range<Pattern>)
  class lazy_split_view;                                                // 独立实现
 
  // split view
 template<forward_range V, forward_range Pattern>
   requires view<V> && view<Pattern> &&
            indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
  class split_view;                                                     // 独立实现
 
  namespace views {
    inline constexpr /* 未指定 */ lazy_split = /* 未指定 */;               // 独立实现
    inline constexpr /* 未指定 */ split = /* 未指定 */;                    // 独立实现
  }
 
  // counted view
  namespace views { inline constexpr /* 未指定 */ counted = /* 未指定 */; }
                                                                        // 独立实现
 
  // common view
  template<view V>
    requires (!common_range<V> && copyable<iterator_t<V>>)
  class common_view;                                                    // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<common_view<T>> =       // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ common = /* 未指定 */; }
                                                                        // 独立实现
 
  // reverse view
  template<view V>
    requires bidirectional_range<V>
  class reverse_view;                                                   // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<reverse_view<T>> =      // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ reverse = /* 未指定 */; }
                                                                        // 独立实现
 
  // as const view
  template<input_range R>
    constexpr auto& __possibly_const_range(R& r) {          // 仅用于阐释
      if constexpr (constant_range<const R> && !constant_range<R>) {
        return const_cast<const R&>(r);
      } else {
        return r;
      }
    }
 
  template<view V>
    requires input_range<V>
  class as_const_view;                                                  // 独立实现
 
  template<class T>
    inline constexpr bool enable_borrowed_range<as_const_view<T>> =     // 独立实现
      enable_borrowed_range<T>;
 
  namespace views { inline constexpr /* 未指定 */ as_const = /* 未指定 */; }
                                                                        // 独立实现
 
  // elements view
  template<input_range V, size_t N>
    requires /* 见描述 */
  class elements_view;                                                  // 独立实现
 
  template<class T, size_t N>
    inline constexpr bool enable_borrowed_range<elements_view<T, N>> =  // 独立实现
      enable_borrowed_range<T>;
 
  template<class R>
    using keys_view = elements_view<R, 0>;                              // 独立实现
  template<class R>
    using values_view = elements_view<R, 1>;                            // 独立实现
 
  namespace views {
    template<size_t N>
      inline constexpr /* 未指定 */ elements = /* 未指定 */;  // 独立实现
    inline constexpr auto keys = elements<0>;                           // 独立实现
    inline constexpr auto values = elements<1>;                         // 独立实现
  }
 
  template<input_range View>
    requires view<View>
  class enumerate_view; // 独立实现
 
  template<class View>
    inline constexpr bool enable_borrowed_range<enumerate_view<View>> = // 独立实现
      enable_borrowed_range<View>;
 
  namespace views {
    inline constexpr /* 未指定 */ enumerate = /* 未指定 */;   // 独立实现
  }
 
  // zip view
  template<input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0)
  class zip_view;                                                       // 独立实现
 
  template<class... Views>
    inline constexpr bool enable_borrowed_range<zip_view<Views...>> =   // 独立实现
      (enable_borrowed_range<Views> && ...);
 
  namespace views { inline constexpr /* 未指定 */ zip = /* 未指定 */; }
                                                                        // 独立实现
 
  // zip transform view
  template<move_constructible F, input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
             regular_invocable<F&, range_reference_t<Views>...> &&
             __can_reference<invoke_result_t<F&, range_reference_t<Views>...>>
  class zip_transform_view;                                             // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ zip_transform =
    /* 未指定 */; }                                                // 独立实现
 
  // adjacent view
  template<forward_range V, size_t N>
    requires view<V> && (N > 0)
  class adjacent_view;                                                  // 独立实现
 
  template<class V, size_t N>
    inline constexpr bool enable_borrowed_range<adjacent_view<V, N>> =  // 独立实现
      enable_borrowed_range<V>;
 
  namespace views {
    template<size_t N>
      inline constexpr /* 未指定 */ adjacent = /* 未指定 */;  // 独立实现
    inline constexpr auto pairwise = adjacent<2>;                       // 独立实现
  }
 
  // adjacent transform view
  template<forward_range V, move_constructible F, size_t N>
    requires /* 见描述 */
  class adjacent_transform_view;                                        // 独立实现
 
  namespace views {
    template<size_t N>
      inline constexpr /* 未指定 */ adjacent_transform =
        /* 未指定 */;                                              // 独立实现
    inline constexpr auto pairwise_transform = adjacent_transform<2>;   // 独立实现
  }
 
  // chunk view
  template<view V>
    requires input_range<V>
  class chunk_view;                                                     // 独立实现
 
  template<view V>
    requires forward_range<V>
  class chunk_view<V>;                                                  // 独立实现
 
  template<class V>
    inline constexpr bool enable_borrowed_range<chunk_view<V>> =        // 独立实现
      forward_range<V> && enable_borrowed_range<V>;
 
  namespace views { inline constexpr /* 未指定 */ chunk =
    /* 未指定 */; }                                                      // 独立实现
 
  // slide view
  template<forward_range V>
    requires view<V>
  class slide_view;                                                     // 独立实现
 
  template<class V>
    inline constexpr bool enable_borrowed_range<slide_view<V>> =
      enable_borrowed_range<V>;                                         // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ slide =
    /* 未指定 */; }                                                      // 独立实现
 
  // chunk by view
  template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class chunk_by_view;                                                  // 独立实现
 
  namespace views { inline constexpr /* 未指定 */ chunk_by =
    /* 未指定 */; }                                                      // 独立实现
 
  // stride view
  template<input_range V>
    requires view<V>
  class stride_view;
 
  template<class V>
    inline constexpr bool enable_borrowed_range<stride_view<V>> =
      enable_borrowed_range<V>;
 
  namespace views { inline constexpr /* 未指定 */ stride = /* 未指定 */; }
 
  // cartesian product view
  template<input_range First, forward_range... Vs>
    requires (view<First> && ... && view<Vs>)
  class cartesian_product_view;
 
  namespace views { inline constexpr /* 未指定 */ cartesian_product =
    /* 未指定 */; }
}
 
namespace std {
  namespace views = ranges::views;                                      // 独立实现
 
  template<class T> struct tuple_size;                                  // 独立实现
  template<size_t I, class T> struct tuple_element;                     // 独立实现
 
  template<class I, class S, ranges::subrange_kind K>
  struct tuple_size<ranges::subrange<I, S, K>>                          // 独立实现
    : integral_constant<size_t, 2> {};
  template<class I, class S, ranges::subrange_kind K>
  struct tuple_element<0, ranges::subrange<I, S, K>> {                  // 独立实现
    using type = I;                                                     // 独立实现
  };
  template<class I, class S, ranges::subrange_kind K>
  struct tuple_element<1, ranges::subrange<I, S, K>> {                  // 独立实现
    using type = S;                                                     // 独立实现
  };
  template<class I, class S, ranges::subrange_kind K>
  struct tuple_element<0, const ranges::subrange<I, S, K>> {            // 独立实现
    using type = I;                                                     // 独立实现
  };
  template<class I, class S, ranges::subrange_kind K>
  struct tuple_element<1, const ranges::subrange<I, S, K>> {            // 独立实现
    using type = S;                                                     // 独立实现
  };
 
  struct from_range_t { explicit from_range_t() = default; };           // 独立实现
  inline constexpr from_range_t from_range{};                           // 独立实现
}

概念 range

namespace std::ranges {
  template< class T >
    concept range = requires(T& t) {
      ranges::begin(t); // 对向前迭代器保持相等性
      ranges::end(t);
  };
}

概念 borrowed_range

namespace std::ranges {
  template<class T>
    concept borrowed_range =
      range<T> && (is_lvalue_reference_v<T> ||
        enable_borrowed_range<remove_cvref_t<T>>);
}

概念 sized_range

namespace std::ranges {
  template< class T >
    concept sized_range = range<T> &&
      requires(T& t) {
        ranges::size(t);
      };
}

概念 view

namespace std::ranges {
  template<class T>
    inline constexpr bool enable_view = derived_from<T, view_base>;
 
  template<class T>
    concept view = range<T>
                && movable<T>
                && enable_view<T>;
}

概念 output_range

namespace std::ranges {
  template<class R, class T>
    concept output_range =
      range<R> && output_iterator<iterator_t<R>, T>;
}

概念 input_range

namespace std::ranges {
  template<class T>
    concept input_range =
      range<T> && input_iterator<iterator_t<T>>;
}

概念 forward_range

namespace std::ranges {
  template<class T>
    concept forward_range =
      input_range<T> && forward_iterator<iterator_t<T>>;
}

概念 bidirectional_range

namespace std::ranges {
  template<class T>
    concept bidirectional_range =
      forward_range<T> && bidirectional_iterator<iterator_t<T>>;
}

概念 random_access_range

namespace std::ranges {
  template<class T>
    concept random_access_range =
      bidirectional_range<T> && random_access_iterator<iterator_t<T>>;
}

概念 contiguous_range

namespace std::ranges {
  template<class T>
    concept contiguous_range =
      random_access_range<T> && contiguous_iterator<iterator_t<T>> &&
        requires(T& t) {
          { ranges::data(t) } -> same_as<add_pointer_t<range_reference_t<T>>>;
        };
}

概念 common_range

namespace std::ranges {
  template<class T>
    concept common_range =
      range<T> && same_as<iterator_t<T>, sentinel_t<T>>;
}

概念 viewable_range

namespace std::ranges {
  template<class T>
    concept viewable_range =
      range<T> && (borrowed_range<T> || view<remove_cvref_t<T>>);
}

辅助概念

注解:如下概念的名字仅用于阐释,他们不是接口的一部分。

namespace std::ranges { // 未指定, for name lookup only
  template<class R>
    concept __simple_view =                                       // 仅用于阐释
      view<R> && range<const R> &&
      same_as<iterator_t<R>, iterator_t<const R>> &&
      same_as<sentinel_t<R>, sentinel_t<const R>>;
 
  template<class I>
    concept __has_arrow =                                         // 仅用于阐释
      input_iterator<I> &&
      (is_pointer_v<I> || requires(I i) { i.operator->(); });
 
  template<class T, class U>
    concept __different_from =                                    // 仅用于阐释
      !same_as<remove_cvref_t<T>, remove_cvref_t<U>>;
}

类模板 std::ranges::view_interface

namespace std::ranges {
  template<class D>
    requires is_class_v<D> && same_as<D, remove_cv_t<D>>
  class view_interface {
  private:
    constexpr D& derived() noexcept {               // 仅用于阐释
      return static_cast<D&>(*this);
    }
    constexpr const D& derived() const noexcept {   // 仅用于阐释
      return static_cast<const D&>(*this);
    }
 
  public:
    constexpr bool empty() requires sized_range<D> || forward_range<D> {
      if constexpr (sized_range<D>)
        return ranges::size(derived()) == 0;
      else
        return ranges::begin(derived()) == ranges::end(derived());
    }
    constexpr bool empty() const requires sized_range<const D> ||
        forward_range<const D> {
      if constexpr (sized_range<const D>)
        return ranges::size(derived()) == 0;
      else
        return ranges::begin(derived()) == ranges::end(derived());
    }
 
    constexpr auto cbegin() {
      return ranges::cbegin(derived());
    }
    constexpr auto cbegin() const requires range<const D> {
      return ranges::cbegin(derived());
    }
    constexpr auto cend() {
      return ranges::cend(derived());
    }
    constexpr auto cend() const requires range<const D> {
      return ranges::cend(derived());
    }
 
    constexpr explicit operator bool()
      requires requires { ranges::empty(derived()); } {
        return !ranges::empty(derived());
      }
    constexpr explicit operator bool() const
      requires requires { ranges::empty(derived()); } {
        return !ranges::empty(derived());
      }
 
    constexpr auto data() requires contiguous_iterator<iterator_t<D>> {
      return to_address(ranges::begin(derived()));
    }
    constexpr auto data() const
      requires range<const D> && contiguous_iterator<iterator_t<const D>> {
        return to_address(ranges::begin(derived()));
      }
 
    constexpr auto size() requires forward_range<D> &&
      sized_sentinel_for<sentinel_t<D>, iterator_t<D>> {
        return ranges::end(derived()) - ranges::begin(derived());
      }
    constexpr auto size() const requires forward_range<const D> &&
      sized_sentinel_for<sentinel_t<const D>, iterator_t<const D>> {
        return ranges::end(derived()) - ranges::begin(derived());
      }
 
    constexpr decltype(auto) front() requires forward_range<D>;
    constexpr decltype(auto) front() const requires forward_range<const D>;
 
    constexpr decltype(auto) back() requires bidirectional_range<D> && common_range<D>;
    constexpr decltype(auto) back() const
      requires bidirectional_range<const D> && common_range<const D>;
 
    template<random_access_range R = D>
      constexpr decltype(auto) operator[](range_difference_t<R> n) {
        return ranges::begin(derived())[n];
      }
    template<random_access_range R = const D>
      constexpr decltype(auto) operator[](range_difference_t<R> n) const {
        return ranges::begin(derived())[n];
      }
  };
}

类模板 std::ranges::subrange

namespace std::ranges {
  template<class From, class To>
    concept __uses_nonqualification_pointer_conversion =      // 仅用于阐释
      is_pointer_v<From> && is_pointer_v<To> &&
      !convertible_to<remove_pointer_t<From>(*)[], remove_pointer_t<To>(*)[]>;
 
  template<class From, class To>
    concept __convertible_to_non_slicing =                    // 仅用于阐释
      convertible_to<From, To> &&
      !__uses_nonqualification_pointer_conversion<decay_t<From>, decay_t<To>>;
 
  template<class T, class U, class V>
    concept __pair_like_convertible_from =                    // 仅用于阐释
      !range<T> && !is_reference_v<T> && __pair_like<T> &&
      constructible_from<T, U, V> &&
      __convertible_to_non_slicing<U, tuple_element_t<0, T>> &&
      convertible_to<V, tuple_element_t<1, T>>;
 
  template<input_or_output_iterator I, sentinel_for<I> S = I, subrange_kind K =
      sized_sentinel_for<S, I> ? subrange_kind::sized : subrange_kind::unsized>
    requires (K == subrange_kind::sized || !sized_sentinel_for<S, I>)
  class subrange : public view_interface<subrange<I, S, K>> {
  private:
    static constexpr bool StoreSize =                       // 仅用于阐释
      K == subrange_kind::sized && !sized_sentinel_for<S, I>;
    I begin_ = I();                                         // 仅用于阐释
    S end_ = S();                                           // 仅用于阐释
    __make_unsigned_like_t<iter_difference_t<I>> size_ = 0;
        // 仅用于阐释;仅当 StoreSize 为真时出现 
  public:
    subrange() requires default_initializable<I> = default;
 
    constexpr subrange(__convertible_to_non_slicing<I> auto i, S s) requires (!StoreSize);
 
    constexpr subrange(__convertible_to_non_slicing<I> auto i, S s,
                       __make_unsigned_like_t<iter_difference_t<I>> n)
      requires (K == subrange_kind::sized);
 
    template<__different_from<subrange> R>
      requires borrowed_range<R> &&
               __convertible_to_non_slicing<iterator_t<R>, I> &&
               convertible_to<sentinel_t<R>, S>
    constexpr subrange(R&& r) requires (!StoreSize || sized_range<R>);
 
    template<borrowed_range R>
      requires __convertible_to_non_slicing<iterator_t<R>, I> &&
               convertible_to<sentinel_t<R>, S>
    constexpr subrange(R&& r, __make_unsigned_like_t<iter_difference_t<I>> n)
      requires (K == subrange_kind::sized)
        : subrange{ranges::begin(r), ranges::end(r), n} {}
 
    template<__different_from<subrange> PairLike>
      requires __pair_like_convertible_from<PairLike, const I&, const S&>
    constexpr operator PairLike() const;
 
    constexpr I begin() const requires copyable<I>;
    [[nodiscard]] constexpr I begin() requires (!copyable<I>);
    constexpr S end() const;
 
    constexpr bool empty() const;
    constexpr __make_unsigned_like_t<iter_difference_t<I>> size() const
      requires (K == subrange_kind::sized);
 
    [[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) const &
      requires forward_iterator<I>;
    [[nodiscard]] constexpr subrange next(iter_difference_t<I> n = 1) &&;
    [[nodiscard]] constexpr subrange prev(iter_difference_t<I> n = 1) const
      requires bidirectional_iterator<I>;
    constexpr subrange& advance(iter_difference_t<I> n);
  };
 
  template<input_or_output_iterator I, sentinel_for<I> S>
    subrange(I, S) -> subrange<I, S>;
 
  template<input_or_output_iterator I, sentinel_for<I> S>
    subrange(I, S, __make_unsigned_like_t<iter_difference_t<I>>) ->
      subrange<I, S, subrange_kind::sized>;
 
  template<borrowed_range R>
    subrange(R&&) ->
      subrange<iterator_t<R>, sentinel_t<R>,
               (sized_range<R> || sized_sentinel_for<sentinel_t<R>, iterator_t<R>>)
                 ? subrange_kind::sized : subrange_kind::unsized>;
 
  template<borrowed_range R>
    subrange(R&&, __make_unsigned_like_t<range_difference_t<R>>) ->
      subrange<iterator_t<R>, sentinel_t<R>, subrange_kind::sized>;
}

std::ranges::dangling

namespace std::ranges {
  struct dangling {
    constexpr dangling() noexcept = default;
    constexpr dangling(auto&&...) noexcept {}
  };
}

std::ranges::elements_of

namespace std::ranges {
  template<range R, class Allocator = allocator<byte>>
  struct elements_of {
    [[no_unique_address]] R range;
    [[no_unique_address]] Allocator allocator = Allocator();
  };
 
  template<class R, class Allocator = allocator<byte>>
    elements_of(R&&, Allocator = Allocator()) -> elements_of<R&&, Allocator>;
}

类模板 std::ranges::empty_view

namespace std::ranges {
  template<class T>
    requires is_object_v<T>
  class empty_view : public view_interface<empty_view<T>> {
  public:
    static constexpr T* begin() noexcept { return nullptr; }
    static constexpr T* end() noexcept { return nullptr; }
    static constexpr T* data() noexcept { return nullptr; }
    static constexpr size_t size() noexcept { return 0; }
    static constexpr bool empty() noexcept { return true; }
  };
}

类模板 std::ranges::single_view

namespace std::ranges {
  template<move_constructible T>
    requires is_object_v<T>
  class single_view : public view_interface<single_view<T>> {
  private:
    __movable_box<T> value_;              // 仅用于阐释
 
  public:
    single_view() requires default_initializable<T> = default;
    constexpr explicit single_view(const T& t) requires copy_constructible<T>;
    constexpr explicit single_view(T&& t);
    template<class... Args>
      requires constructible_from<T, Args...>
    constexpr explicit single_view(in_place_t, Args&&... args);
 
    constexpr T* begin() noexcept;
    constexpr const T* begin() const noexcept;
    constexpr T* end() noexcept;
    constexpr const T* end() const noexcept;
    static constexpr size_t size() noexcept;
    constexpr T* data() noexcept;
    constexpr const T* data() const noexcept;
  };
 
  template<class T>
    single_view(T) -> single_view<T>;
}

类模板 std::ranges::iota_view

namespace std::ranges {
  template<class I>
    concept decrementable = /* 见描述 */;  // 仅用于阐释
 
  template<class I>
    concept advanceable = /* 见描述 */;    // 仅用于阐释
 
  template<weakly_incrementable W, semiregular Bound = unreachable_sentinel_t>
    requires __weakly_equality_comparable_with<W, Bound> && copyable<W>
  class iota_view : public view_interface<iota_view<W, Bound>> {
  private:
    // 类 iota_view::iterator
    struct iterator;                    // 仅用于阐释
 
    // 类 iota_view::sentinel
    struct sentinel;                    // 仅用于阐释
 
    W value_ = W();                     // 仅用于阐释
    Bound bound_ = Bound();             // 仅用于阐释
 
  public:
    iota_view() requires default_initializable<W> = default;
    constexpr explicit iota_view(W value);
    constexpr explicit iota_view(type_identity_t<W> value, type_identity_t<Bound> bound);
    constexpr explicit iota_view(iterator first, /* 见描述 */ last);
 
    constexpr iterator begin() const;
    constexpr auto end() const;
    constexpr iterator end() const requires same_as<W, Bound>;
 
    constexpr auto size() const requires /* 见描述 */;
  };
 
  template<class W, class Bound>
    requires (!__is_integer_like<W> || !__is_integer_like<Bound> ||
              (__is_signed_integer_like<W> == __is_signed_integer_like<Bound>))
    iota_view(W, Bound) -> iota_view<W, Bound>;
}

类模板 std::ranges::iota_view::iterator

namespace std::ranges {
  template<weakly_incrementable W, semiregular Bound>
    requires __weakly_equality_comparable_with<W, Bound> && copyable<W>
  struct iota_view<W, Bound>::iterator {
  private:
    W value_ = W();             // 仅用于阐释
  public:
    using iterator_concept = /* 见描述 */;
    using iterator_category = input_iterator_tag; // 仅当 W 实现
      // __incrementable 且 __IOTA_DIFF_T(W) 是整数类型
 
    using value_type = W;
    using difference_type = __IOTA_DIFF_T(W);
 
    iterator() requires default_initializable<W> = default;
    constexpr explicit iterator(W value);
 
    constexpr W operator*() const noexcept(is_nothrow_copy_constructible_v<W>);
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires incrementable<W>;
 
    constexpr iterator& operator--() requires decrementable<W>;
    constexpr iterator operator--(int) requires decrementable<W>;
 
    constexpr iterator& operator+=(difference_type n)
      requires advanceable<W>;
    constexpr iterator& operator-=(difference_type n)
      requires advanceable<W>;
    constexpr W operator[](difference_type n) const
      requires advanceable<W>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<W>;
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires totally_ordered<W>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires totally_ordered<W>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires totally_ordered<W>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires totally_ordered<W>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires totally_ordered<W> && three_way_comparable<W>;
 
    friend constexpr iterator operator+(iterator i, difference_type n)
      requires advanceable<W>;
    friend constexpr iterator operator+(difference_type n, iterator i)
      requires advanceable<W>;
 
    friend constexpr iterator operator-(iterator i, difference_type n)
      requires advanceable<W>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires advanceable<W>;
  };
}

类模板 std::ranges::iota_view::sentinel

namespace std::ranges {
  template<weakly_incrementable W, semiregular Bound>
    requires __weakly_equality_comparable_with<W, Bound> && copyable<W>
  struct iota_view<W, Bound>::sentinel {
  private:
    Bound bound_ = Bound();     // 仅用于阐释
  public:
    sentinel() = default;
    constexpr explicit sentinel(Bound bound);
 
    friend constexpr bool operator==(const iterator& x, const sentinel& y);
 
    friend constexpr iter_difference_t<W> operator-(const iterator& x, const sentinel& y)
      requires sized_sentinel_for<Bound, W>;
    friend constexpr iter_difference_t<W> operator-(const sentinel& x, const iterator& y)
      requires sized_sentinel_for<Bound, W>;
  };
}

类模板 std::ranges::repeat_view

namespace std::ranges {
  template<move_constructible W, semiregular Bound = unreachable_sentinel_t>
    requires (is_object_v<W> && same_as<W, remove_cv_t<W>> &&
              (__is_integer_like<Bound> || same_as<Bound, unreachable_sentinel_t>))
  class repeat_view : public view_interface<repeat_view<W, Bound>> {
  private:
    // 类 repeat_view::iterator
    struct iterator;                            // 仅用于阐释
 
    __movable_box<W> value_ = W();              // 仅用于阐释
    Bound bound_ = Bound();                     // 仅用于阐释
 
  public:
    repeat_view() requires default_initializable<W> = default;
 
    constexpr explicit repeat_view(const W& value, Bound bound = Bound())
      requires copy_constructible<W>;
    constexpr explicit repeat_view(W&& value, Bound bound = Bound());
    template<class... WArgs, class... BoundArgs>
      requires constructible_from<W, WArgs...> &&
               constructible_from<Bound, BoundArgs...>
    constexpr explicit repeat_view(piecewise_construct_t,
      tuple<WArgs...> value_args, tuple<BoundArgs...> bound_args = tuple<>{});
 
    constexpr iterator begin() const;
    constexpr iterator end() const requires (!same_as<Bound, unreachable_sentinel_t>);
    constexpr unreachable_sentinel_t end() const noexcept;
 
    constexpr auto size() const requires (!same_as<Bound, unreachable_sentinel_t>);
  };
 
  template<class W, class Bound>
    repeat_view(W, Bound) -> repeat_view<W, Bound>;
}

类模板 std::ranges::repeat_view::iterator

namespace std::ranges {
  template<move_constructible W, semiregular Bound = unreachable_sentinel_t>
    requires (is_object_v<W> && same_as<W, remove_cv_t<W>> &&
              (__is_integer_like<Bound> || same_as<Bound, unreachable_sentinel_t>))
  class repeat_view<W, Bound>::iterator {
  private:
    using __index_type =                            // 仅用于阐释
      conditional_t<same_as<Bound, unreachable_sentinel_t>, ptrdiff_t, Bound>;
    const W* value_ = nullptr;                      // 仅用于阐释
    __index_type current_ = __index_type();         // 仅用于阐释
 
    constexpr explicit iterator(const W* value,
                                __index_type b = __index_type());   // 仅用于阐释
 
  public:
    using iterator_concept = random_access_iterator_tag;
    using iterator_category = random_access_iterator_tag;
    using value_type = W;
    using difference_type = conditional_t<__is_signed_integer_like<__index_type>,
        __index_type,
        __IOTA_DIFF_T(__index_type)>;
 
    iterator() = default;
 
    constexpr const W& operator*() const noexcept;
 
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    constexpr iterator& operator--();
    constexpr iterator operator--(int);
 
    constexpr iterator& operator+=(difference_type n);
    constexpr iterator& operator-=(difference_type n);
    constexpr const W& operator[](difference_type n) const noexcept;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
    friend constexpr auto operator<=>(const iterator& x, const iterator& y);
 
    friend constexpr iterator operator+(iterator i, difference_type n);
    friend constexpr iterator operator+(difference_type n, iterator i);
 
    friend constexpr iterator operator-(iterator i, difference_type n);
    friend constexpr difference_type operator-(const iterator& x, const iterator& y);
  };
}

类模板 std::ranges::basic_istream_view

namespace std::ranges {
  template<class Val, class CharT, class Traits>
    concept __stream_extractable =                // 仅用于阐释
      requires(basic_istream<CharT, Traits>& is, Val& t) {
         is >> t;
      };
 
  template<movable Val, class CharT, class Traits = char_traits<CharT>>
    requires default_initializable<Val> && __stream_extractable<Val, CharT, Traits>
  class basic_istream_view :
    public view_interface<basic_istream_view<Val, CharT, Traits>> {
  public:
    constexpr explicit basic_istream_view(basic_istream<CharT, Traits>& stream);
 
    constexpr auto begin() {
      *stream_ >> value_;
      return iterator{*this};
    }
 
    constexpr default_sentinel_t end() const noexcept;
 
  private:
    // 类 basic_istream_view::iterator
    struct iterator;                            // 仅用于阐释
    basic_istream<CharT, Traits>* stream_;      // 仅用于阐释
    Val value_ = Val();                         // 仅用于阐释
  };
}

类模板 std::ranges::basic_istream_view::iterator

namespace std::ranges {
  template<movable Val, class CharT, class Traits>
    requires default_initializable<Val> &&
             __stream_extractable<Val, CharT, Traits>
  class basic_istream_view<Val, CharT, Traits>::iterator {
  public:
    using iterator_concept = input_iterator_tag;
    using difference_type = ptrdiff_t;
    using value_type = Val;
 
    constexpr explicit iterator(basic_istream_view& parent) noexcept;
 
    iterator(const iterator&) = delete;
    iterator(iterator&&) = default;
 
    iterator& operator=(const iterator&) = delete;
    iterator& operator=(iterator&&) = default;
 
    iterator& operator++();
    void operator++(int);
 
    Val& operator*() const;
 
    friend bool operator==(const iterator& x, default_sentinel_t);
 
  private:
    basic_istream_view* parent_;                                // 仅用于阐释
  };
}

类模板 std::ranges::ref_view

namespace std::ranges {
  template<range R>
    requires is_object_v<R>
  class ref_view : public view_interface<ref_view<R>> {
  private:
    R* r_;                      // 仅用于阐释
  public:
    template<__different_from<ref_view> T>
      requires /* 见描述 */
    constexpr ref_view(T&& t);
 
    constexpr R& base() const { return *r_; }
 
    constexpr iterator_t<R> begin() const { return ranges::begin(*r_); }
    constexpr sentinel_t<R> end() const { return ranges::end(*r_); }
 
    constexpr bool empty() const
      requires requires { ranges::empty(*r_); }
    { return ranges::empty(*r_); }
 
    constexpr auto size() const requires sized_range<R>
    { return ranges::size(*r_); }
 
    constexpr auto data() const requires contiguous_range<R>
    { return ranges::data(*r_); }
  };
 
  template<class R>
    ref_view(R&) -> ref_view<R>;
}

类模板 std::ranges::owning_view

namespace std::ranges {
  template<range R>
    requires movable<R> && (!__is_initializer_list<R>)
  class owning_view : public view_interface<owning_view<R>> {
  private:
    R r_ = R();         // 仅用于阐释
  public:
    owning_view() requires default_initializable<R> = default;
    constexpr owning_view(R&& t);
 
    owning_view(owning_view&&) = default;
    owning_view& operator=(owning_view&&) = default;
 
    constexpr R& base() & noexcept { return r_; }
    constexpr const R& base() const & noexcept { return r_; }
    constexpr R&& base() && noexcept { return std::move(r_); }
    constexpr const R&& base() const && noexcept { return std::move(r_); }
 
    constexpr iterator_t<R> begin() { return ranges::begin(r_); }
    constexpr sentinel_t<R> end() { return ranges::end(r_); }
 
    constexpr auto begin() const requires range<const R>
    { return ranges::begin(r_); }
    constexpr auto end() const requires range<const R>
    { return ranges::end(r_); }
 
    constexpr bool empty() requires requires { ranges::empty(r_); }
    { return ranges::empty(r_); }
    constexpr bool empty() const requires requires { ranges::empty(r_); }
    { return ranges::empty(r_); }
 
    constexpr auto size() requires sized_range<R>
    { return ranges::size(r_); }
    constexpr auto size() const requires sized_range<const R>
    { return ranges::size(r_); }
 
    constexpr auto data() requires contiguous_range<R>
    { return ranges::data(r_); }
    constexpr auto data() const requires contiguous_range<const R>
    { return ranges::data(r_); }
  };
}

类模板 std::ranges::as_rvalue_view

namespace std::ranges {
  template<view V>
    requires input_range<V>
  class as_rvalue_view : public view_interface<as_rvalue_view<V>> {
    V base_ = V();      // 仅用于阐释
 
  public:
    as_rvalue_view() requires default_initializable<V> = default;
    constexpr explicit as_rvalue_view(V base);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() requires (!__simple_view<V>)
    { return move_iterator(ranges::begin(base_)); }
    constexpr auto begin() const requires range<const V>
    { return move_iterator(ranges::begin(base_)); }
 
    constexpr auto end() requires (!__simple_view<V>) {
      if constexpr (common_range<V>) {
        return move_iterator(ranges::end(base_));
      } else {
        return move_sentinel(ranges::end(base_));
      }
    }
    constexpr auto end() const requires range<const V> {
      if constexpr (common_range<const V>) {
        return move_iterator(ranges::end(base_));
      } else {
        return move_sentinel(ranges::end(base_));
      }
    }
 
    constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
    constexpr auto size() const requires sized_range<const V> {
        return ranges::size(base_);
    }
  };
 
  template<class R>
    as_rvalue_view(R&&) -> as_rvalue_view<views::all_t<R>>;
}

类模板 std::ranges::filter_view

namespace std::ranges {
  template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class filter_view : public view_interface<filter_view<V, Pred>> {
  private:
    V base_ = V();                              // 仅用于阐释
    __movable_box<Pred> pred_;                  // 仅用于阐释
 
    // 类 filter_view::iterator
    class iterator;                             // 仅用于阐释
 
    // 类 filter_view::sentinel
    class sentinel;                             // 仅用于阐释
 
  public:
    filter_view() requires default_initializable<V> &&
      default_initializable<Pred> = default;
    constexpr explicit filter_view(V base, Pred pred);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr const Pred& pred() const;
 
    constexpr iterator begin();
    constexpr auto end() {
      if constexpr (common_range<V>)
        return iterator{*this, ranges::end(base_)};
      else
        return sentinel{*this};
    }
  };
 
  template<class R, class Pred>
    filter_view(R&&, Pred) -> filter_view<views::all_t<R>, Pred>;
}

类模板 std::ranges::filter_view::iterator

namespace std::ranges {
  template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class filter_view<V, Pred>::iterator {
  private:
    iterator_t<V> current_ = iterator_t<V>();   // 仅用于阐释
    filter_view* parent_ = nullptr;             // 仅用于阐释
 
  public:
    using iterator_concept  = /* 见描述 */;
    using iterator_category = /* 见描述 */;        // 不总存在
    using value_type        = range_value_t<V>;
    using difference_type   = range_difference_t<V>;
 
    iterator() requires default_initializable<iterator_t<V>> = default;
    constexpr iterator(filter_view& parent, iterator_t<V> current);
 
    constexpr const iterator_t<V>& base() const & noexcept;
    constexpr iterator_t<V> base() &&;
    constexpr range_reference_t<V> operator*() const;
    constexpr iterator_t<V> operator->() const
      requires __has_arrow<iterator_t<V>> && copyable<iterator_t<V>>;
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<V>;
 
    constexpr iterator& operator--() requires bidirectional_range<V>;
    constexpr iterator operator--(int) requires bidirectional_range<V>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<iterator_t<V>>;
 
    friend constexpr range_rvalue_reference_t<V> iter_move(const iterator& i)
      noexcept(noexcept(ranges::iter_move(i.current_)));
 
    friend constexpr void iter_swap(const iterator& x, const iterator& y)
      noexcept(noexcept(ranges::iter_swap(x.current_, y.current_)))
      requires indirectly_swappable<iterator_t<V>>;
  };
}

类模板 std::ranges::filter_view::sentinel

namespace std::ranges {
  template<input_range V, indirect_unary_predicate<iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class filter_view<V, Pred>::sentinel {
  private:
    sentinel_t<V> end_ = sentinel_t<V>();       // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr explicit sentinel(filter_view& parent);
 
    constexpr sentinel_t<V> base() const;
 
    friend constexpr bool operator==(const iterator& x, const sentinel& y);
  };
}

类模板 std::ranges::transform_view

namespace std::ranges {
  template<input_range V, move_constructible F>
    requires view<V> && is_object_v<F> &&
             regular_invocable<F&, range_reference_t<V>> &&
             __can_reference<invoke_result_t<F&, range_reference_t<V>>>
  class transform_view : public view_interface<transform_view<V, F>> {
  private:
    //类模板 transform_view::iterator
    template<bool> struct iterator;             // 仅用于阐释
 
    //类模板 transform_view::sentinel
    template<bool> struct sentinel;             // 仅用于阐释
 
    V base_ = V();                              // 仅用于阐释
    __movable_box<F> fun_;                      // 仅用于阐释
 
  public:
    transform_view() requires default_initializable<V> &&
      default_initializable<F> = default;
    constexpr explicit transform_view(V base, F fun);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr iterator<false> begin();
    constexpr iterator<true> begin() const
      requires range<const V> &&
               regular_invocable<const F&, range_reference_t<const V>>;
 
    constexpr sentinel<false> end();
    constexpr iterator<false> end() requires common_range<V>;
    constexpr sentinel<true> end() const
      requires range<const V> &&
               regular_invocable<const F&, range_reference_t<const V>>;
    constexpr iterator<true> end() const
      requires common_range<const V> &&
               regular_invocable<const F&, range_reference_t<const V>>;
 
    constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
    constexpr auto size() const requires sized_range<const V>
    { return ranges::size(base_); }
  };
 
  template<class R, class F>
    transform_view(R&&, F) -> transform_view<views::all_t<R>, F>;
}

类模板 std::ranges::transform_view::iterator

namespace std::ranges {
  template<input_range V, move_constructible F>
    requires view<V> && is_object_v<F> &&
             regular_invocable<F&, range_reference_t<V>> &&
             __can_reference<invoke_result_t<F&, range_reference_t<V>>>
  template<bool Const>
  class transform_view<V, F>::iterator {
  private:
    using Parent = __maybe_const<Const, transform_view>;        // 仅用于阐释
    using Base = __maybe_const<Const, V>;                       // 仅用于阐释
    iterator_t<Base> current_ = iterator_t<Base>();             // 仅用于阐释
    Parent* parent_ = nullptr;                                  // 仅用于阐释
 
  public:
    using iterator_concept  = /* 见描述 */;
    using iterator_category = /* 见描述 */;            // 不总存在
    using value_type        =
      remove_cvref_t<invoke_result_t<__maybe_const<Const, F>&, range_reference_t<Base>>>;
    using difference_type   = range_difference_t<Base>;
 
    iterator() requires default_initializable<iterator_t<Base>> = default;
    constexpr iterator(Parent& parent, iterator_t<Base> current);
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
 
    constexpr const iterator_t<Base>& base() const & noexcept;
    constexpr iterator_t<Base> base() &&;
 
    constexpr decltype(auto) operator*() const
      noexcept(noexcept(invoke(*parent_->fun_, *current_))) {
      return invoke(*parent_->fun_, *current_);
    }
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<Base>;
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type n)
      requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type n)
      requires random_access_range<Base>;
 
    constexpr decltype(auto) operator[](difference_type n) const
      requires random_access_range<Base> {
      return invoke(*parent_->fun_, current_[n]);
    }
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<iterator_t<Base>>;
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(iterator i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, iterator i)
      requires random_access_range<Base>;
 
    friend constexpr iterator operator-(iterator i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
  };
}

类模板 std::ranges::transform_view::sentinel

namespace std::ranges {
  template<input_range V, move_constructible F>
    requires view<V> && is_object_v<F> &&
             regular_invocable<F&, range_reference_t<V>> &&
             __can_reference<invoke_result_t<F&, range_reference_t<V>>>
  template<bool Const>
  class transform_view<V, F>::sentinel {
  private:
    using Parent = __maybe_const<Const, transform_view>;    // 仅用于阐释
    using Base = __maybe_const<Const, V>;                   // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();             // 仅用于阐释
  public:
    sentinel() = default;
    constexpr explicit sentinel(sentinel_t<Base> end);
    constexpr sentinel(sentinel<!Const> i)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr sentinel_t<Base> base() const;
 
    template<bool OtherConst>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const sentinel& y, const iterator<OtherConst>& x);
  };
}

类模板 std::ranges::take_view

namespace std::ranges {
  template<view V>
  class take_view : public view_interface<take_view<V>> {
  private:
    V base_ = V();                                      // 仅用于阐释
    range_difference_t<V> count_ = 0;                   // 仅用于阐释
 
    //类模板 take_view::sentinel
    template<bool> class sentinel;                      // 仅用于阐释
 
  public:
    take_view() requires default_initializable<V> = default;
    constexpr explicit take_view(V base, range_difference_t<V> count);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() requires (!__simple_view<V>) {
      if constexpr (sized_range<V>) {
        if constexpr (random_access_range<V>) {
          return ranges::begin(base_);
        } else {
          auto sz = range_difference_t<V>(size());
          return counted_iterator(ranges::begin(base_), sz);
        }
      } else {
        return counted_iterator(ranges::begin(base_), count_);
      }
    }
 
    constexpr auto begin() const requires range<const V> {
      if constexpr (sized_range<const V>) {
        if constexpr (random_access_range<const V>) {
          return ranges::begin(base_);
        } else {
          auto sz = range_difference_t<const V>(size());
          return counted_iterator(ranges::begin(base_), sz);
        }
      } else {
        return counted_iterator(ranges::begin(base_), count_);
      }
    }
 
    constexpr auto end() requires (!__simple_view<V>) {
      if constexpr (sized_range<V>) {
        if constexpr (random_access_range<V>)
          return ranges::begin(base_) + range_difference_t<V>(size());
        else
          return default_sentinel;
      } else {
        return sentinel<false>{ranges::end(base_)};
      }
    }
 
    constexpr auto end() const requires range<const V> {
      if constexpr (sized_range<const V>) {
        if constexpr (random_access_range<const V>)
          return ranges::begin(base_) + range_difference_t<const V>(size());
        else
          return default_sentinel;
      } else {
        return sentinel<true>{ranges::end(base_)};
      }
    }
 
    constexpr auto size() requires sized_range<V> {
      auto n = ranges::size(base_);
      return ranges::min(n, static_cast<decltype(n)>(count_));
    }
 
    constexpr auto size() const requires sized_range<const V> {
      auto n = ranges::size(base_);
      return ranges::min(n, static_cast<decltype(n)>(count_));
    }
  };
 
  template<class R>
    take_view(R&&, range_difference_t<R>)
      -> take_view<views::all_t<R>>;
}

类模板 std::ranges::take_view::sentinel

namespace std::ranges {
  template<view V>
  template<bool Const>
  class take_view<V>::sentinel {
  private:
    using Base = __maybe_const<Const, V>;                           // 仅用于阐释
    template<bool OtherConst>
      using CI = counted_iterator<
        iterator_t<__maybe_const<OtherConst, V>>>;                  // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();                     // 仅用于阐释
  public:
    sentinel() = default;
    constexpr explicit sentinel(sentinel_t<Base> end);
    constexpr sentinel(sentinel<!Const> s)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr sentinel_t<Base> base() const;
 
    friend constexpr bool operator==(const CI<Const>& y, const sentinel& x);
 
    template<bool OtherConst = !Const>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const CI<OtherConst>& y, const sentinel& x);
  };
}

类模板 std::ranges::take_while_view

namespace std::ranges {
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> &&
             indirect_unary_predicate<const Pred, iterator_t<V>>
  class take_while_view : public view_interface<take_while_view<V, Pred>> {
    //类模板 take_while_view::sentinel
    template<bool> class sentinel;                      // 仅用于阐释
 
    V base_ = V();                                      // 仅用于阐释
    __movable_box<Pred> pred_;                          // 仅用于阐释
 
  public:
    take_while_view() requires default_initializable<V> &&
      default_initializable<Pred> = default;
    constexpr explicit take_while_view(V base, Pred pred);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr const Pred& pred() const;
 
    constexpr auto begin() requires (!__simple_view<V>)
    { return ranges::begin(base_); }
 
    constexpr auto begin() const
      requires range<const V> &&
               indirect_unary_predicate<const Pred, iterator_t<const V>>
    { return ranges::begin(base_); }
 
    constexpr auto end() requires (!__simple_view<V>)
    { return sentinel<false>(ranges::end(base_), addressof(*pred_)); }
 
    constexpr auto end() const
      requires range<const V> &&
               indirect_unary_predicate<const Pred, iterator_t<const V>>
    { return sentinel<true>(ranges::end(base_), addressof(*pred_)); }
  };
 
  template<class R, class Pred>
    take_while_view(R&&, Pred) -> take_while_view<views::all_t<R>, Pred>;
}

类模板 std::ranges::take_while_view::sentinel

namespace std::ranges {
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> &&
             indirect_unary_predicate<const Pred, iterator_t<V>>
  template<bool Const>
  class take_while_view<V, Pred>::sentinel {
    using Base = __maybe_const<Const, V>;               // 仅用于阐释
 
    sentinel_t<Base> end_ = sentinel_t<Base>();         // 仅用于阐释
    const Pred* pred_ = nullptr;                        // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr explicit sentinel(sentinel_t<Base> end, const Pred* pred);
    constexpr sentinel(sentinel<!Const> s)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr sentinel_t<Base> base() const { return end_; }
 
    friend constexpr bool operator==(const iterator_t<Base>& x, const sentinel& y);
 
    template<bool OtherConst = !Const>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator_t<__maybe_const<OtherConst, V>>& x,
                                     const sentinel& y);
  };
}

类模板 std::ranges::drop_view

namespace std::ranges {
  template<view V>
  class drop_view : public view_interface<drop_view<V>> {
  public:
    drop_view() requires default_initializable<V> = default;
    constexpr explicit drop_view(V base, range_difference_t<V> count);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin()
      requires (!(__simple_view<V> &&
                  random_access_range<const V> && sized_range<const V>));
    constexpr auto begin() const
      requires random_access_range<const V> && sized_range<const V>;
 
    constexpr auto end() requires (!__simple_view<V>)
    { return ranges::end(base_); }
 
    constexpr auto end() const requires range<const V>
    { return ranges::end(base_); }
 
    constexpr auto size() requires sized_range<V> {
      const auto s = ranges::size(base_);
      const auto c = static_cast<decltype(s)>(count_);
      return s < c ? 0 : s - c;
    }
 
    constexpr auto size() const requires sized_range<const V> {
      const auto s = ranges::size(base_);
      const auto c = static_cast<decltype(s)>(count_);
      return s < c ? 0 : s - c;
    }
 
  private:
    V base_ = V();                              // 仅用于阐释
    range_difference_t<V> count_ = 0;           // 仅用于阐释
  };
 
  template<class R>
    drop_view(R&&, range_difference_t<R>) -> drop_view<views::all_t<R>>;
}

类模板 std::ranges::drop_while_view

namespace std::ranges {
  template<view V, class Pred>
    requires input_range<V> && is_object_v<Pred> &&
             indirect_unary_predicate<const Pred, iterator_t<V>>
  class drop_while_view : public view_interface<drop_while_view<V, Pred>> {
  public:
    drop_while_view() requires default_initializable<V> &&
      default_initializable<Pred> = default;
    constexpr explicit drop_while_view(V base, Pred pred);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr const Pred& pred() const;
 
    constexpr auto begin();
 
    constexpr auto end() { return ranges::end(base_); }
 
  private:
    V base_ = V();                                      // 仅用于阐释
    __movable_box<Pred> pred_;                          // 仅用于阐释
  };
 
  template<class R, class Pred>
    drop_while_view(R&&, Pred) -> drop_while_view<views::all_t<R>, Pred>;
}

类模板 std::ranges::join_view

namespace std::ranges {
  template<input_range V>
    requires view<V> && input_range<range_reference_t<V>>
  class join_view : public view_interface<join_view<V>> {
  private:
    using InnerRng = range_reference_t<V>;                  // 仅用于阐释
 
    //类模板 join_view::iterator
    template<bool Const>
      struct iterator;                                      // 仅用于阐释
 
    //类模板 join_view::sentinel
    template<bool Const>
      struct sentinel;                                      // 仅用于阐释
 
    V base_ = V();                                          // 仅用于阐释
 
    __non_propagating_cache<remove_cv_t<InnerRng>> inner_;
                                                    // 仅用于阐释
                                                    // 仅当 !is_reference_v<InnerRng> 时存在
 
  public:
    join_view() requires default_initializable<V> = default;
    constexpr explicit join_view(V base);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() {
      constexpr bool use_const = __simple_view<V> &&
                                 is_reference_v<InnerRng>;
      return iterator<use_const>{*this, ranges::begin(base_)};
    }
 
    constexpr auto begin() const
      requires input_range<const V> &&
               is_reference_v<range_reference_t<const V>>
    { return iterator<true>{*this, ranges::begin(base_)}; }
 
    constexpr auto end() {
      if constexpr (forward_range<V> &&
                    is_reference_v<InnerRng> && forward_range<InnerRng> &&
                    common_range<V> && common_range<InnerRng>)
        return iterator<__simple_view<V>>{*this, ranges::end(base_)};
      else
        return sentinel<__simple_view<V>>{*this};
    }
 
    constexpr auto end() const
      requires input_range<const V> &&
               is_reference_v<range_reference_t<const V>> {
      if constexpr (forward_range<const V> &&
                    forward_range<range_reference_t<const V>> &&
                    common_range<const V> &&
                    common_range<range_reference_t<const V>>)
        return iterator<true>{*this, ranges::end(base_)};
      else
        return sentinel<true>{*this};
    }
  };
 
  template<class R>
    explicit join_view(R&&) -> join_view<views::all_t<R>>;
}

类模板 std::ranges::join_view::iterator

namespace std::ranges {
  template<input_range V>
    requires view<V> && input_range<range_reference_t<V>>
  template<bool Const>
  struct join_view<V>::iterator {
  private:
    using Parent    = __maybe_const<Const, join_view>;          // 仅用于阐释
    using Base      = __maybe_const<Const, V>;                  // 仅用于阐释
    using OuterIter = iterator_t<Base>;                         // 仅用于阐释
    using InnerIter = iterator_t<range_reference_t<Base>>;      // 仅用于阐释
 
    static constexpr bool __ref_is_glvalue =                    // 仅用于阐释
      is_reference_v<range_reference_t<Base>>;
 
    OuterIter outer_ = OuterIter();                             // 仅用于阐释
    InnerIter inner_ = InnerIter();                             // 仅用于阐释
    Parent* parent_  = nullptr;                                 // 仅用于阐释
 
    constexpr void satisfy();                                   // 仅用于阐释
 
  public:
    using iterator_concept  = /* 见描述 */;
    using iterator_category = /* 见描述 */;            // 不总存在
    using value_type        = range_value_t<range_reference_t<Base>>;
    using difference_type   = /* 见描述 */;
 
    iterator() requires default_initializable<OuterIter> &&
                         default_initializable<InnerIter> = default;
    constexpr iterator(Parent& parent, OuterIter outer);
    constexpr iterator(iterator<!Const> i)
      requires Const &&
               convertible_to<iterator_t<V>, OuterIter> &&
               convertible_to<iterator_t<InnerRng>, InnerIter>;
 
    constexpr decltype(auto) operator*() const { return *inner_; }
 
    constexpr InnerIter operator->() const
      requires __has_arrow<InnerIter> && copyable<InnerIter>;
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int)
      requires __ref_is_glvalue && forward_range<Base> &&
               forward_range<range_reference_t<Base>>;
 
    constexpr iterator& operator--()
      requires __ref_is_glvalue && bidirectional_range<Base> &&
               bidirectional_range<range_reference_t<Base>> &&
               common_range<range_reference_t<Base>>;
 
    constexpr iterator operator--(int)
      requires __ref_is_glvalue && bidirectional_range<Base> &&
               bidirectional_range<range_reference_t<Base>> &&
               common_range<range_reference_t<Base>>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires __ref_is_glvalue && equality_comparable<iterator_t<Base>> &&
               equality_comparable<iterator_t<range_reference_t<Base>>>;
 
    friend constexpr decltype(auto) iter_move(const iterator& i)
    noexcept(noexcept(ranges::iter_move(i.inner_))) {
      return ranges::iter_move(i.inner_);
    }
 
    friend constexpr void iter_swap(const iterator& x, const iterator& y)
      noexcept(noexcept(ranges::iter_swap(x.inner_, y.inner_)))
      requires indirectly_swappable<InnerIter>;
  };
}

类模板 std::ranges::join_view::sentinel

namespace std::ranges {
  template<input_range V>
    requires view<V> && input_range<range_reference_t<V>>
  template<bool Const>
  struct join_view<V>::sentinel {
  private:
    using Parent = __maybe_const<Const, join_view>;     // 仅用于阐释
    using Base = __maybe_const<Const, V>;               // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();         // 仅用于阐释
 
  public:
    sentinel() = default;
 
    constexpr explicit sentinel(Parent& parent);
    constexpr sentinel(sentinel<!Const> s)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    template<bool OtherConst>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
  };
}

类模板 std::ranges::join_with_view

namespace std::ranges {
  template<class R, class P>
  concept __compatible_joinable_ranges =            // 仅用于阐释
      common_with<range_value_t<R>, range_value_t<P>> &&
      common_reference_with<range_reference_t<R>, range_reference_t<P>> &&
      common_reference_with<range_rvalue_reference_t<R>, range_rvalue_reference_t<P>>;
 
  template<class R>
  concept __bidirectional_common = bidirectional_range<R> &&
    common_range<R>;                                        // 仅用于阐释
 
  template<input_range V, forward_range Pattern>
    requires view<V> && input_range<range_reference_t<V>>
          && view<Pattern>
          && __compatible_joinable_ranges<range_reference_t<V>, Pattern>
  class join_with_view : public view_interface<join_with_view<V, Pattern>> {
    using InnerRng = range_reference_t<V>;                  // 仅用于阐释
 
    V base_ = V();                                          // 仅用于阐释
    __non_propagating_cache<remove_cv_t<InnerRng>> inner_;
        // 仅用于阐释
        // 仅当 !is_reference_v<InnerRng> 时存在
 
    Pattern pattern_ = Pattern();                           // 仅用于阐释
 
    //类模板 join_with_view::iterator
    template<bool Const> struct iterator;                   // 仅用于阐释
 
    //类模板 join_with_view::sentinel
    template<bool Const> struct sentinel;                   // 仅用于阐释
 
  public:
    join_with_view()
      requires default_initializable<V> && default_initializable<Pattern> = default;
 
    constexpr explicit join_with_view(V base, Pattern pattern);
 
    template<input_range R>
      requires constructible_from<V, views::all_t<R>> &&
               constructible_from<Pattern, single_view<range_value_t<InnerRng>>>
    constexpr explicit join_with_view(R&& r, range_value_t<InnerRng> e);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() {
      constexpr bool use_const =
        __simple_view<V> && is_reference_v<InnerRng> && __simple_view<Pattern>;
      return iterator<use_const>{*this, ranges::begin(base_)};
    }
    constexpr auto begin() const
      requires input_range<const V> &&
               forward_range<const Pattern> &&
               is_reference_v<range_reference_t<const V>> {
      return iterator<true>{*this, ranges::begin(base_)};
    }
 
    constexpr auto end() {
      if constexpr (forward_range<V> &&
                    is_reference_v<InnerRng> && forward_range<InnerRng> &&
                    common_range<V> && common_range<InnerRng>)
        return iterator<__simple_view<V> &&
          __simple_view<Pattern>>{*this, ranges::end(base_)};
      else
        return sentinel<__simple_view<V> && __simple_view<Pattern>>{*this};
    }
    constexpr auto end() const
      requires input_range<const V> && forward_range<const Pattern> &&
               is_reference_v<range_reference_t<const V>> {
      using InnerConstRng = range_reference_t<const V>;
      if constexpr (forward_range<const V> && forward_range<InnerConstRng> &&
                    common_range<const V> && common_range<InnerConstRng>)
        return iterator<true>{*this, ranges::end(base_)};
      else
        return sentinel<true>{*this};
    }
  };
 
  template<class R, class P>
    join_with_view(R&&, P&&) -> join_with_view<views::all_t<R>, views::all_t<P>>;
 
  template<input_range R>
    join_with_view(R&&, range_value_t<range_reference_t<R>>)
      -> join_with_view<views::all_t<R>,
            single_view<range_value_t<range_reference_t<R>>>>;
}

类模板 std::ranges::join_with_view::iterator

namespace std::ranges {
  template<input_range V, forward_range Pattern>
    requires view<V> && input_range<range_reference_t<V>>
          && view<Pattern> && __compatible_joinable_ranges<range_reference_t<V>, Pattern>
  template<bool Const>
  class join_with_view<V, Pattern>::iterator {
    using Parent = __maybe_const<Const, join_with_view>;                // 仅用于阐释
    using Base = __maybe_const<Const, V>;                               // 仅用于阐释
    using InnerBase = range_reference_t<Base>;                          // 仅用于阐释
    using PatternBase = __maybe_const<Const, Pattern>;                  // 仅用于阐释
 
    using OuterIter = iterator_t<Base>;                                 // 仅用于阐释
    using InnerIter = iterator_t<InnerBase>;                            // 仅用于阐释
    using PatternIter = iterator_t<PatternBase>;                        // 仅用于阐释
 
    static constexpr bool __ref_is_glvalue = is_reference_v<InnerBase>; // 仅用于阐释
 
    Parent* parent_ = nullptr;                                          // 仅用于阐释
    OuterIter outer_it_ = OuterIter();                                  // 仅用于阐释
    variant<PatternIter, InnerIter> inner_it_;                          // 仅用于阐释
 
    constexpr iterator(Parent& parent, iterator_t<Base> outer);         // 仅用于阐释
    constexpr auto&& __update_inner(const OuterIter&);                  // 仅用于阐释
    constexpr auto&& __get_inner(const OuterIter&);                     // 仅用于阐释
    constexpr void satisfy();                                           // 仅用于阐释
 
  public:
    using iterator_concept = /* 见描述 */;
    using iterator_category = /* 见描述 */;            // 不总存在
    using value_type = /* 见描述 */;
    using difference_type = /* 见描述 */;
 
    iterator() requires default_initializable<OuterIter> = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, OuterIter> &&
               convertible_to<iterator_t<InnerRng>, InnerIter> &&
               convertible_to<iterator_t<Pattern>, PatternIter>;
 
    constexpr decltype(auto) operator*() const;
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int)
      requires __ref_is_glvalue && forward_iterator<OuterIter> &&
               forward_iterator<InnerIter>;
 
    constexpr iterator& operator--()
      requires __ref_is_glvalue && bidirectional_range<Base> &&
               __bidirectional_common<InnerBase> && __bidirectional_common<PatternBase>;
    constexpr iterator operator--(int)
      requires __ref_is_glvalue && bidirectional_range<Base> &&
               __bidirectional_common<InnerBase> && __bidirectional_common<PatternBase>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires __ref_is_glvalue && equality_comparable<OuterIter> &&
               equality_comparable<InnerIter>;
 
    friend constexpr decltype(auto) iter_move(const iterator& x) {
      using rvalue_reference = common_reference_t<
        iter_rvalue_reference_t<InnerIter>,
        iter_rvalue_reference_t<PatternIter>>;
      return visit<rvalue_reference>(ranges::iter_move, x.inner_it_);
    }
 
    friend constexpr void iter_swap(const iterator& x, const iterator& y)
      requires indirectly_swappable<InnerIter, PatternIter> {
      visit(ranges::iter_swap, x.inner_it_, y.inner_it_);
    }
  };
}

类模板 std::ranges::join_with_view::sentinel

namespace std::ranges {
  template<input_range V, forward_range Pattern>
    requires view<V> && input_range<range_reference_t<V>>
          && view<Pattern> && __compatible_joinable_ranges<range_reference_t<V>, Pattern>
  template<bool Const>
  class join_with_view<V, Pattern>::sentinel {
    using Parent = __maybe_const<Const, join_with_view>;    // 仅用于阐释
    using Base = __maybe_const<Const, V>;                   // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();             // 仅用于阐释
 
    constexpr explicit sentinel(Parent& parent);            // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> s)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    template<bool OtherConst>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
  };
}

类模板 std::ranges::lazy_split_view

namespace std::ranges {
  template<auto> struct __require_constant;                       // 仅用于阐释
 
  template<class R>
  concept __tiny_range =                                          // 仅用于阐释
    sized_range<R> &&
    requires { typename __require_constant<remove_reference_t<R>::size()>; } &&
    (remove_reference_t<R>::size() <= 1);
 
  template<input_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
             &&
             (forward_range<V> || __tiny_range<Pattern>)
  class lazy_split_view : public view_interface<lazy_split_view<V, Pattern>> {
  private:
    V base_ = V();                                              // 仅用于阐释
    Pattern pattern_ = Pattern();                               // 仅用于阐释
 
    __non_propagating_cache<iterator_t<V>> current_;    // 仅用于阐释
                                                        // 仅当 !forward_range<V> 时存在
 
    //类模板 lazy_split_view::outer-iterator
    template<bool> struct __outer_iterator;                     // 仅用于阐释
 
    //类模板 lazy_split_view::inner-iterator
    template<bool> struct __inner_iterator;                     // 仅用于阐释
 
  public:
    lazy_split_view()
      requires default_initializable<V> && default_initializable<Pattern> = default;
    constexpr explicit lazy_split_view(V base, Pattern pattern);
 
    template<input_range R>
      requires constructible_from<V, views::all_t<R>> &&
               constructible_from<Pattern, single_view<range_value_t<R>>>
    constexpr explicit lazy_split_view(R&& r, range_value_t<R> e);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() {
      if constexpr (forward_range<V>) {
        return __outer_iterator<__simple_view<V> && __simple_view<Pattern>>
          {*this, ranges::begin(base_)};
      } else {
        current_ = ranges::begin(base_);
        return __outer_iterator<false>{*this};
      }
    }
 
    constexpr auto begin() const requires forward_range<V> && forward_range<const V> {
      return __outer_iterator<true>{*this, ranges::begin(base_)};
    }
 
    constexpr auto end() requires forward_range<V> && common_range<V> {
      return __outer_iterator<__simple_view<V> && __simple_view<Pattern>>
        {*this, ranges::end(base_)};
    }
 
    constexpr auto end() const {
      if constexpr (forward_range<V> && forward_range<const V> && common_range<const V>)
        return __outer_iterator<true>{*this, ranges::end(base_)};
      else
        return default_sentinel;
    }
  };
 
  template<class R, class P>
    lazy_split_view(R&&, P&&) -> lazy_split_view<views::all_t<R>, views::all_t<P>>;
 
  template<input_range R>
    lazy_split_view(R&&, range_value_t<R>)
      -> lazy_split_view<views::all_t<R>, single_view<range_value_t<R>>>;
}

类模板 std::ranges::lazy_split_view::outer_iterator

namespace std::ranges {
  template<input_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
             &&
             (forward_range<V> || __tiny_range<Pattern>)
  template<bool Const>
  struct lazy_split_view<V, Pattern>::__outer_iterator {
  private:
    using Parent = __maybe_const<Const, lazy_split_view>;   // 仅用于阐释
    using Base = __maybe_const<Const, V>;                   // 仅用于阐释
    Parent* parent_ = nullptr;                              // 仅用于阐释
 
    iterator_t<Base> current_ = iterator_t<Base>();     // 仅用于阐释
                                                        // 仅当 V 实现 forward_range 时存在
 
    bool trailing_empty_ = false;                           // 仅用于阐释
 
  public:
    using iterator_concept  =
      conditional_t<forward_range<Base>, forward_iterator_tag, input_iterator_tag>;
 
    using iterator_category = input_iterator_tag;           // 仅当 Base 实现 forward_range 时存在
 
    // 类 lazy_split_view::outer-iterator::value_type
    struct value_type;
    using difference_type   = range_difference_t<Base>;
 
    __outer_iterator() = default;
    constexpr explicit __outer_iterator(Parent& parent)
      requires (!forward_range<Base>);
    constexpr __outer_iterator(Parent& parent, iterator_t<Base> current)
      requires forward_range<Base>;
    constexpr __outer_iterator(__outer_iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
 
    constexpr value_type operator*() const;
 
    constexpr __outer_iterator& operator++();
    constexpr decltype(auto) operator++(int) {
      if constexpr (forward_range<Base>) {
        auto tmp = *this;
        ++*this;
        return tmp;
      } else
        ++*this;
    }
 
    friend constexpr bool operator==(const __outer_iterator& x, const __outer_iterator& y)
      requires forward_range<Base>;
 
    friend constexpr bool operator==(const __outer_iterator& x, default_sentinel_t);
  };
}

类模板 std::ranges::lazy_split_view::outer_iterator::value_type

namespace std::ranges {
  template<input_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
             &&
             (forward_range<V> || __tiny_range<Pattern>)
  template<bool Const>
  struct lazy_split_view<V, Pattern>::__outer_iterator<Const>::value_type
    : view_interface<value_type> {
  private:
    __outer_iterator i_ = __outer_iterator();               // 仅用于阐释
  public:
    value_type() = default;
    constexpr explicit value_type(__outer_iterator i);
 
    constexpr __inner_iterator<Const> begin() const;
    constexpr default_sentinel_t end() const noexcept;
  };
}

类模板 std::ranges::lazy_split_view::inner_iterator

namespace std::ranges {
  template<input_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
             &&
             (forward_range<V> || __tiny_range<Pattern>)
  template<bool Const>
  struct lazy_split_view<V, Pattern>::__inner_iterator {
  private:
    using Base = __maybe_const<Const, V>;                   // 仅用于阐释
    __outer_iterator<Const> i_ = __outer_iterator<Const>(); // 仅用于阐释
    bool incremented_ = false;                              // 仅用于阐释
 
  public:
    using iterator_concept  = typename __outer_iterator<Const>::iterator_concept;
 
    using iterator_category = /* 见描述 */;        // 仅当 Base 实现 forward_range 时存在
    using value_type        = range_value_t<Base>;
    using difference_type   = range_difference_t<Base>;
 
    __inner_iterator() = default;
    constexpr explicit __inner_iterator(__outer_iterator<Const> i);
 
    constexpr const iterator_t<Base>& base() const & noexcept;
    constexpr iterator_t<Base> base() && requires forward_range<V>;
 
    constexpr decltype(auto) operator*() const { return *i_.current; }
 
    constexpr __inner_iterator& operator++();
    constexpr decltype(auto) operator++(int) {
      if constexpr (forward_range<Base>) {
        auto tmp = *this;
        ++*this;
        return tmp;
      } else
        ++*this;
    }
 
    friend constexpr bool operator==(const __inner_iterator& x, const __inner_iterator& y)
      requires forward_range<Base>;
 
    friend constexpr bool operator==(const __inner_iterator& x, default_sentinel_t);
 
    friend constexpr decltype(auto) iter_move(const __inner_iterator& i)
    noexcept(noexcept(ranges::iter_move(i.i_.current))) {
      return ranges::iter_move(i.i_.current);
    }
 
    friend constexpr void iter_swap(const __inner_iterator& x, const __inner_iterator& y)
      noexcept(noexcept(ranges::iter_swap(x.i_.current, y.i_.current)))
      requires indirectly_swappable<iterator_t<Base>>;
  };
}

类模板 std::ranges::split_view

namespace std::ranges {
  template<forward_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
  class split_view : public view_interface<split_view<V, Pattern>> {
  private:
    V base_ = V();                              // 仅用于阐释
    Pattern pattern_ = Pattern();               // 仅用于阐释
 
    // 类 split_view::iterator
    struct iterator;                            // 仅用于阐释
 
    // 类 split_view::sentinel
    struct sentinel;                            // 仅用于阐释
 
  public:
    split_view()
      requires default_initializable<V> && default_initializable<Pattern> = default;
    constexpr explicit split_view(V base, Pattern pattern);
 
    template<forward_range R>
      requires constructible_from<V, views::all_t<R>> &&
               constructible_from<Pattern, single_view<range_value_t<R>>>
    constexpr explicit split_view(R&& r, range_value_t<R> e);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr iterator begin();
 
    constexpr auto end() {
      if constexpr (common_range<V>) {
        return iterator{*this, ranges::end(base_), {}};
      } else {
        return sentinel{*this};
      }
    }
 
    constexpr subrange<iterator_t<V>> __find_next(iterator_t<V>); // 仅用于阐释
  };
 
  template<class R, class P>
    split_view(R&&, P&&) -> split_view<views::all_t<R>, views::all_t<P>>;
 
  template<forward_range R>
    split_view(R&&, range_value_t<R>)
      -> split_view<views::all_t<R>, single_view<range_value_t<R>>>;
}

类模板 std::ranges::split_view::iterator

namespace std::ranges {
  template<forward_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
  class split_view<V, Pattern>::iterator {
  private:
    split_view* parent_ = nullptr;                              // 仅用于阐释
    iterator_t<V> cur_ = iterator_t<V>();                       // 仅用于阐释
    subrange<iterator_t<V>> next_ = subrange<iterator_t<V>>();  // 仅用于阐释
    bool trailing_empty_ = false;                               // 仅用于阐释
 
  public:
    using iterator_concept = forward_iterator_tag;
    using iterator_category = input_iterator_tag;
    using value_type = subrange<iterator_t<V>>;
    using difference_type = range_difference_t<V>;
 
    iterator() = default;
    constexpr iterator(split_view& parent, iterator_t<V> current,
                       subrange<iterator_t<V>> next);
 
    constexpr iterator_t<V> base() const;
    constexpr value_type operator*() const;
 
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
  };
}

类模板 std::ranges::split_view::sentinel

namespace std::ranges {
  template<forward_range V, forward_range Pattern>
    requires view<V> && view<Pattern> &&
             indirectly_comparable<iterator_t<V>, iterator_t<Pattern>, ranges::equal_to>
  struct split_view<V, Pattern>::sentinel {
  private:
    sentinel_t<V> end_ = sentinel_t<V>();               // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr explicit sentinel(split_view& parent);
 
    friend constexpr bool operator==(const iterator& x, const sentinel& y);
  };
}

类模板 std::ranges::common_view

namespace std::ranges {
  template<view V>
    requires (!common_range<V> && copyable<iterator_t<V>>)
  class common_view : public view_interface<common_view<V>> {
  private:
    V base_ = V();  // 仅用于阐释
  public:
    common_view() requires default_initializable<V> = default;
 
    constexpr explicit common_view(V r);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() {
      if constexpr (random_access_range<V> && sized_range<V>)
        return ranges::begin(base_);
      else
        return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::begin(base_));
    }
 
    constexpr auto begin() const requires range<const V> {
      if constexpr (random_access_range<const V> && sized_range<const V>)
        return ranges::begin(base_);
      else
        return common_iterator<iterator_t<const V>, sentinel_t<const V>>(
          ranges::begin(base_));
    }
 
    constexpr auto end() {
      if constexpr (random_access_range<V> && sized_range<V>)
        return ranges::begin(base_) + ranges::size(base_);
      else
        return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::end(base_));
    }
 
    constexpr auto end() const requires range<const V> {
      if constexpr (random_access_range<const V> && sized_range<const V>)
        return ranges::begin(base_) + ranges::size(base_);
      else
        return common_iterator<iterator_t<const V>, sentinel_t<const V>>(
          ranges::end(base_));
    }
 
    constexpr auto size() requires sized_range<V> {
      return ranges::size(base_);
    }
    constexpr auto size() const requires sized_range<const V> {
      return ranges::size(base_);
    }
  };
 
  template<class R>
    common_view(R&&) -> common_view<views::all_t<R>>;
}

类模板 std::ranges::reverse_view

namespace std::ranges {
  template<view V>
    requires bidirectional_range<V>
  class reverse_view : public view_interface<reverse_view<V>> {
  private:
    V base_ = V();  // 仅用于阐释
  public:
    reverse_view() requires default_initializable<V> = default;
 
    constexpr explicit reverse_view(V r);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr reverse_iterator<iterator_t<V>> begin();
    constexpr reverse_iterator<iterator_t<V>> begin() requires common_range<V>;
    constexpr auto begin() const requires common_range<const V>;
 
    constexpr reverse_iterator<iterator_t<V>> end();
    constexpr auto end() const requires common_range<const V>;
 
    constexpr auto size() requires sized_range<V> {
      return ranges::size(base_);
    }
 
    constexpr auto size() const requires sized_range<const V> {
      return ranges::size(base_);
    }
  };
 
  template<class R>
    reverse_view(R&&) -> reverse_view<views::all_t<R>>;
}

类模板 std::ranges::as_const_view

namespace std::ranges {
  template<view V>
    requires input_range<V>
  class as_const_view : public view_interface<as_const_view<V>> {
    V base_ = V();      // 仅用于阐释
 
  public:
    as_const_view() requires default_initializable<V> = default;
    constexpr explicit as_const_view(V base);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() requires (!__simple_view<V>) { return ranges::cbegin(base_); }
    constexpr auto begin() const requires range<const V> { return ranges::cbegin(base_); }
 
    constexpr auto end() requires (!__simple_view<V>) { return ranges::cend(base_); }
    constexpr auto end() const requires range<const V> { return ranges::cend(base_); }
 
    constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
    constexpr auto size() const requires sized_range<const V> {
      return ranges::size(base_);
    }
  };
 
  template<class R>
    as_const_view(R&&) -> as_const_view<views::all_t<R>>;
}

类模板 std::ranges::elements_view

namespace std::ranges {
  template<class T, size_t N>
  concept __has_tuple_element =                   // 仅用于阐释
    __tuple_like<T> && N < tuple_size_v<T>;
 
  template<class T, size_t N>
  concept __returnable_element =                  // 仅用于阐释
    is_reference_v<T> || move_constructible<tuple_element_t<N, T>>;
 
  template<input_range V, size_t N>
    requires view<V> && __has_tuple_element<range_value_t<V>, N> &&
             __has_tuple_element<remove_reference_t<range_reference_t<V>>, N> &&
             __returnable_element<range_reference_t<V>, N>
  class elements_view : public view_interface<elements_view<V, N>> {
  public:
    elements_view() requires default_initializable<V> = default;
    constexpr explicit elements_view(V base);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() requires (!__simple_view<V>)
    { return iterator<false>(ranges::begin(base_)); }
 
    constexpr auto begin() const requires range<const V>
    { return iterator<true>(ranges::begin(base_)); }
 
    constexpr auto end() requires (!__simple_view<V> && !common_range<V>)
    { return sentinel<false>{ranges::end(base_)}; }
 
    constexpr auto end() requires (!__simple_view<V> && common_range<V>)
    { return iterator<false>{ranges::end(base_)}; }
 
    constexpr auto end() const requires range<const V>
    { return sentinel<true>{ranges::end(base_)}; }
 
    constexpr auto end() const requires common_range<const V>
    { return iterator<true>{ranges::end(base_)}; }
 
    constexpr auto size() requires sized_range<V>
    { return ranges::size(base_); }
 
    constexpr auto size() const requires sized_range<const V>
    { return ranges::size(base_); }
 
  private:
    //类模板 elements_view::iterator
    template<bool> class iterator;                      // 仅用于阐释
 
    //类模板 elements_view::sentinel
    template<bool> class sentinel;                      // 仅用于阐释
 
    V base_ = V();                                      // 仅用于阐释
  };
}

类模板 std::ranges::elements_view::iterator

namespace std::ranges {
  template<input_range V, size_t N>
    requires view<V> && __has_tuple_element<range_value_t<V>, N> &&
             __has_tuple_element<remove_reference_t<range_reference_t<V>>, N> &&
             __returnable_element<range_reference_t<V>, N>
  template<bool Const>
  class elements_view<V, N>::iterator {
    using Base = __maybe_const<Const, V>;               // 仅用于阐释
 
    iterator_t<Base> current_ = iterator_t<Base>();     // 仅用于阐释
 
    static constexpr decltype(auto)
      __get_element(const iterator_t<Base>& i);         // 仅用于阐释
 
  public:
    using iterator_concept = /* 见描述 */;
    using iterator_category = /* 见描述 */;                // 不总存在
    using value_type = remove_cvref_t<tuple_element_t<N, range_value_t<Base>>>;
    using difference_type = range_difference_t<Base>;
 
    iterator() requires default_initializable<iterator_t<Base>> = default;
    constexpr explicit iterator(iterator_t<Base> current);
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
 
    constexpr const iterator_t<Base>& base() const & noexcept;
    constexpr iterator_t<Base> base() &&;
 
    constexpr decltype(auto) operator*() const
    { return __get_element(current_); }
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<Base>;
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type x)
      requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x)
      requires random_access_range<Base>;
 
    constexpr decltype(auto) operator[](difference_type n) const
      requires random_access_range<Base>
    { return __get_element(current_ + n); }
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<iterator_t<Base>>;
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(const iterator& x, difference_type y)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& x, difference_type y)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
  };
}

类模板 std::ranges::elements_view::sentinel

namespace std::ranges {
  template<input_range V, size_t N>
    requires view<V> && __has_tuple_element<range_value_t<V>, N> &&
             __has_tuple_element<remove_reference_t<range_reference_t<V>>, N> &&
             __returnable_element<range_reference_t<V>, N>
  template<bool Const>
  class elements_view<V, N>::sentinel {
  private:
    using Base = __maybe_const<Const, V>;               // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();         // 仅用于阐释
  public:
    sentinel() = default;
    constexpr explicit sentinel(sentinel_t<Base> end);
    constexpr sentinel(sentinel<!Const> other)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr sentinel_t<Base> base() const;
 
    template<bool OtherConst>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const sentinel& x, const iterator<OtherConst>& y);
  };
}

类模板 std::ranges::enumerate_view

template<view V>
requires __range_with_movable_references<V>
class enumerate_view : public view_interface<enumerate_view<V>>
{
  V base_ = V(); // 仅用于阐释
  template<bool Const>
  class iterator; // 仅用于阐释
  template<bool Const>
  class sentinel; // 仅用于阐释
public:
  constexpr enumerate_view() requires default_initializable<V> = default;
  constexpr explicit enumerate_view(V base);
  constexpr auto begin() requires(!__simple_view<V>) {
    return iterator<false>(ranges::begin(base_), 0);
  }
  constexpr auto begin() const requires __range_with_movable_references<const V> {
    return iterator<true>(ranges::begin(base_), 0);
  }
  constexpr auto end() requires(!__simple_view<V>) {
    if constexpr (common_range<V> && sized_range<V>)
      return iterator<false>(ranges::end(base_), ranges::distance(base_));
    else
      return sentinel<false>(ranges::end(base_));
  }
  constexpr auto end() const requires __range_with_movable_references<const V> {
    if constexpr (common_range<const V> && sized_range<const V>)
      return iterator<true>(ranges::end(base_), ranges::distance(base_));
    else
      return sentinel<true>(ranges::end(base_));
  }
  constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
  constexpr auto size() const requires sized_range<const V> {
    return ranges::size(base_);
  }
  constexpr V base() const& requires copy_constructible<V> { return base_; }
  constexpr V base() && { return std::move(base_); }
};
template<class R>
  enumerate_view(R&&) -> enumerate_view<views::all_t<R>>;
}

类模板 std::ranges::enumerate_view::iterator

namespace std::ranges {
  template<view V>
  requires __range_with_movable_references<V>
  template<bool Const>
  class enumerate_view<V>::iterator
  {
    using Base = __maybe_const<Const, V>; // 仅用于阐释
  public:
    using iterator_category = input_iterator_tag;
    using iterator_concept  = /* 见描述 */;
    using difference_type   = range_difference_t<Base>;
    using value_type        = tuple<difference_type, range_value_t<Base>>;
 
  private:
    using __reference_type = // 仅用于阐释
      tuple<difference_type, range_reference_t<Base>>;
    iterator_t<Base> current_ = iterator_t<Base>(); // 仅用于阐释
    difference_type pos_      = 0;                  // 仅用于阐释
    constexpr explicit iterator(iterator_t<Base> current,
                                difference_type pos); // 仅用于阐释
  public:
    iterator() requires default_initializable<iterator_t<Base>>
    = default;
    constexpr iterator(iterator<!Const> i) requires Const
      && convertible_to<iterator_t<V>, iterator_t<Base>>;
    constexpr const iterator_t<Base>& base() const& noexcept;
    constexpr iterator_t<Base> base() &&;
    constexpr difference_type index() const noexcept;
    constexpr auto operator*() const { return __reference_type(pos_, *current_); }
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<Base>;
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
    constexpr iterator& operator+=(difference_type x) requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x) requires random_access_range<Base>;
    constexpr auto operator[](difference_type n) const requires random_access_range<Base>
    {
      return __reference_type(pos_ + n, current_[n]);
    }
    friend constexpr bool operator==(const iterator& x, const iterator& y) noexcept;
    friend constexpr strong_ordering operator<=>(const iterator& x,
                                                 const iterator& y) noexcept;
    friend constexpr iterator operator+(const iterator& x, difference_type y) requires
      random_access_range<Base>;
    friend constexpr iterator operator+(difference_type x, const iterator& y) requires
      random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& x, difference_type y) requires
      random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y);
    friend constexpr auto iter_move(const iterator& i) noexcept(
      noexcept(ranges::iter_move(i.current_)) &&
      is_nothrow_move_constructible_v<range_rvalue_reference_t<Base>>)
    {
      return tuple<difference_type, range_rvalue_reference_t<Base>>(
        pos_, ranges::iter_move(i.current_));
    }
  };
}

类模板 std::ranges::enumerate_view::sentinel

namespace std::ranges {
  template<view V>
  requires __range_with_movable_references<V>
  template<bool Const>
  class enumerate_view<V>::sentinel
  {                                                  // 仅用于阐释
    using Base            = __maybe_const<Const, V>; // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();      // 仅用于阐释
    constexpr explicit sentinel(sentinel_t<Base> end);
 
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> other) requires Const
      && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
    constexpr sentinel_t<Base> base() const;
    template<bool OtherConst>
    requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
    template<bool OtherConst>
    requires sized_sentinel_for<sentinel_t<Base>,
                                iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>> operator-(
      const iterator<OtherConst>& x,
      const sentinel& y);
    template<bool OtherConst>
    requires sized_sentinel_for<sentinel_t<Base>,
                                iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>> operator-(
      const sentinel& x,
      const iterator<OtherConst>& y);
  };
}

类模板 std::ranges::zip_view

namespace std::ranges {
  template<class... Rs>
  concept __zip_is_common =             // 仅用于阐释
    (sizeof...(Rs) == 1 && (common_range<Rs> && ...)) ||
    (!(bidirectional_range<Rs> && ...) && (common_range<Rs> && ...)) ||
    ((random_access_range<Rs> && ...) && (sized_range<Rs> && ...));
 
  template<input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0)
  class zip_view : public view_interface<zip_view<Views...>> {
    tuple<Views...> views_;             // 仅用于阐释
 
    //类模板 zip_view::iterator
    template<bool> class iterator;      // 仅用于阐释
 
    //类模板 zip_view::sentinel
    template<bool> class sentinel;      // 仅用于阐释
 
  public:
    zip_view() = default;
    constexpr explicit zip_view(Views... views);
 
    constexpr auto begin() requires (!(__simple_view<Views> && ...)) {
      return iterator<false>(__tuple_transform(ranges::begin, views_));
    }
    constexpr auto begin() const requires (range<const Views> && ...) {
      return iterator<true>(__tuple_transform(ranges::begin, views_));
    }
 
    constexpr auto end() requires (!(__simple_view<Views> && ...)) {
      if constexpr (!__zip_is_common<Views...>) {
        return sentinel<false>(__tuple_transform(ranges::end, views_));
      } else if constexpr ((random_access_range<Views> && ...)) {
        return begin() + iter_difference_t<iterator<false>>(size());
      } else {
        return iterator<false>(__tuple_transform(ranges::end, views_));
      }
    }
 
    constexpr auto end() const requires (range<const Views> && ...) {
      if constexpr (!__zip_is_common<const Views...>) {
        return sentinel<true>(__tuple_transform(ranges::end, views_));
      } else if constexpr ((random_access_range<const Views> && ...)) {
        return begin() + iter_difference_t<iterator<true>>(size());
      } else {
        return iterator<true>(__tuple_transform(ranges::end, views_));
      }
    }
 
    constexpr auto size() requires (sized_range<Views> && ...);
    constexpr auto size() const requires (sized_range<const Views> && ...);
  };
 
  template<class... Rs>
    zip_view(Rs&&...) -> zip_view<views::all_t<Rs>...>;
}

类模板 std::ranges::zip_view::iterator

namespace std::ranges {
  template<bool Const, class... Views>
    concept __all_random_access =                 // 仅用于阐释
      (random_access_range<__maybe_const<Const, Views>> && ...);
  template<bool Const, class... Views>
    concept __all_bidirectional =                 // 仅用于阐释
      (bidirectional_range<__maybe_const<Const, Views>> && ...);
  template<bool Const, class... Views>
    concept __all_forward =                       // 仅用于阐释
      (forward_range<__maybe_const<Const, Views>> && ...);
 
  template<input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0)
  template<bool Const>
  class zip_view<Views...>::iterator {
    tuple<iterator_t<__maybe_const<Const, Views>>...> current_;     // 仅用于阐释
    constexpr explicit iterator(tuple<iterator_t<__maybe_const<Const, Views>>...>);
                                                                    // 仅用于阐释
  public:
    using iterator_category = input_iterator_tag;                   // 不总存在
    using iterator_concept  = /* 见描述 */;
    using value_type = tuple<range_value_t<__maybe_const<Const, Views>>...>;
    using difference_type = common_type_t<range_difference_t<
      __maybe_const<Const, Views>>...>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && (convertible_to<iterator_t<Views>, iterator_t<const Views>>
        && ...);
 
    constexpr auto operator*() const;
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires __all_forward<Const, Views...>;
 
    constexpr iterator& operator--() requires __all_bidirectional<Const, Views...>;
    constexpr iterator operator--(int) requires __all_bidirectional<Const, Views...>;
 
    constexpr iterator& operator+=(difference_type x)
      requires __all_random_access<Const, Views...>;
    constexpr iterator& operator-=(difference_type x)
      requires __all_random_access<Const, Views...>;
 
    constexpr auto operator[](difference_type n) const
      requires __all_random_access<Const, Views...>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires (equality_comparable<iterator_t<__maybe_const<Const, Views>>> && ...);
 
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires __all_random_access<Const, Views...>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires __all_random_access<Const, Views...>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires __all_random_access<Const, Views...>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires __all_random_access<Const, Views...>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires (sized_sentinel_for<iterator_t<__maybe_const<Const, Views>>,
                                   iterator_t<__maybe_const<Const, Views>>> && ...);
 
    friend constexpr auto iter_move(const iterator& i) noexcept(/* 见描述 */);
 
    friend constexpr void iter_swap(const iterator& l, const iterator& r)
        noexcept(/* 见描述 */)
      requires (indirectly_swappable<iterator_t<__maybe_const<Const, Views>>> && ...);
  };
}

类模板 std::ranges::zip_view::sentinel

namespace std::ranges {
  template<input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0)
  template<bool Const>
  class zip_view<Views...>::sentinel {
    tuple<sentinel_t<__maybe_const<Const, Views>>...> end_;         // 仅用于阐释
    constexpr explicit sentinel(tuple<sentinel_t<__maybe_const<Const, Views>>...> end);
                                                                    // 仅用于阐释
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> i)
      requires Const && (convertible_to<sentinel_t<Views>,
                         sentinel_t<const Views>> && ...);
 
    template<bool OtherConst>
      requires (sentinel_for<sentinel_t<__maybe_const<Const, Views>>,
                             iterator_t<__maybe_const<OtherConst, Views>>> && ...)
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires (sized_sentinel_for<sentinel_t<__maybe_const<Const, Views>>,
                                   iterator_t<__maybe_const<OtherConst, Views>>> && ...)
    friend
      constexpr common_type_t<range_difference_t<__maybe_const<OtherConst, Views>>...>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires (sized_sentinel_for<sentinel_t<__maybe_const<Const, Views>>,
                                   iterator_t<__maybe_const<OtherConst, Views>>> && ...)
    friend
      constexpr common_type_t<range_difference_t<__maybe_const<OtherConst, Views>>...>
      operator-(const sentinel& y, const iterator<OtherConst>& x);
  };
}

类模板 std::ranges::zip_transform_view

namespace std::ranges {
  template<move_constructible F, input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
              regular_invocable<F&, range_reference_t<Views>...> &&
              __can_reference<invoke_result_t<F&, range_reference_t<Views>...>>
  class zip_transform_view : public view_interface<zip_transform_view<F, Views...>> {
    __movable_box<F> fun_;                    // 仅用于阐释
    zip_view<Views...> zip_;                // 仅用于阐释
 
    using InnerView = zip_view<Views...>;   // 仅用于阐释
    template<bool Const>
      using ziperator = iterator_t<__maybe_const<Const, InnerView>>;    // 仅用于阐释
    template<bool Const>
      using zentinel = sentinel_t<__maybe_const<Const, InnerView>>;     // 仅用于阐释
 
    //类模板 zip_transform_view::iterator
    template<bool> class iterator;          // 仅用于阐释
 
    //类模板 zip_transform_view::sentinel
    template<bool> class sentinel;          // 仅用于阐释
 
  public:
    zip_transform_view() = default;
 
    constexpr explicit zip_transform_view(F fun, Views... views);
 
    constexpr auto begin() { return iterator<false>(*this, zip_.begin()); }
 
    constexpr auto begin() const
      requires range<const InnerView> &&
               regular_invocable<const F&, range_reference_t<const Views>...> {
      return iterator<true>(*this, zip_.begin());
    }
 
    constexpr auto end() {
      if constexpr (common_range<InnerView>) {
        return iterator<false>(*this, zip_.end());
      } else {
        return sentinel<false>(zip_.end());
      }
    }
 
    constexpr auto end() const
      requires range<const InnerView> &&
               regular_invocable<const F&, range_reference_t<const Views>...> {
      if constexpr (common_range<const InnerView>) {
        return iterator<true>(*this, zip_.end());
      } else {
        return sentinel<true>(zip_.end());
      }
    }
 
    constexpr auto size() requires sized_range<InnerView> {
      return zip_.size();
    }
 
    constexpr auto size() const requires sized_range<const InnerView> {
      return zip_.size();
    }
  };
 
  template<class F, class... Rs>
    zip_transform_view(F, Rs&&...) -> zip_transform_view<F, views::all_t<Rs>...>;
}

类模板 std::ranges::zip_transform_view::iterator

namespace std::ranges {
  template<move_constructible F, input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
              regular_invocable<F&, range_reference_t<Views>...> &&
              __can_reference<invoke_result_t<F&, range_reference_t<Views>...>>
  template<bool Const>
  class zip_transform_view<F, Views...>::iterator {
    using Parent = __maybe_const<Const, zip_transform_view>;    // 仅用于阐释
    using Base = __maybe_const<Const, InnerView>;               // 仅用于阐释
    Parent* parent_ = nullptr;                                  // 仅用于阐释
    ziperator<Const> inner_;                                    // 仅用于阐释
 
    constexpr iterator(Parent& parent, ziperator<Const> inner); // 仅用于阐释
 
  public:
    using iterator_category = /* 见描述 */;            // 不总存在
    using iterator_concept  = typename ziperator<Const>::iterator_concept;
    using value_type =
      remove_cvref_t<invoke_result_t<__maybe_const<Const, F>&,
                                     range_reference_t<__maybe_const<Const, Views>>...>>;
    using difference_type = range_difference_t<Base>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<ziperator<false>, ziperator<Const>>;
 
    constexpr decltype(auto) operator*() const noexcept(/* 见描述 */);
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<Base>;
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type x) requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x) requires random_access_range<Base>;
 
    constexpr decltype(auto) operator[](difference_type n) const
      requires random_access_range<Base>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<ziperator<Const>>;
 
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<ziperator<Const>, ziperator<Const>>;
  };
}

类模板 std::ranges::zip_transform_view::sentinel

namespace std::ranges {
  template<move_constructible F, input_range... Views>
    requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
              regular_invocable<F&, range_reference_t<Views>...> &&
              __can_reference<invoke_result_t<F&, range_reference_t<Views>...>>
  template<bool Const>
  class zip_transform_view<F, Views...>::sentinel {
    zentinel<Const> inner_;                                     // 仅用于阐释
    constexpr explicit sentinel(zentinel<Const> inner);         // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> i)
      requires Const && convertible_to<zentinel<false>, zentinel<Const>>;
 
    template<bool OtherConst>
      requires sentinel_for<zentinel<Const>, ziperator<OtherConst>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<zentinel<Const>, ziperator<OtherConst>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, InnerView>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<zentinel<Const>, ziperator<OtherConst>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, InnerView>>
      operator-(const sentinel& x, const iterator<OtherConst>& y);
  };
}

类模板 std::ranges::adjacent_view

namespace std::ranges {
  template<forward_range V, size_t N>
    requires view<V> && (N > 0)
  class adjacent_view : public view_interface<adjacent_view<V, N>> {
    V base_ = V();                      // 仅用于阐释
 
    //类模板 adjacent_view::iterator
    template<bool> class iterator;      // 仅用于阐释
 
    //类模板 adjacent_view::sentinel
    template<bool> class sentinel;      // 仅用于阐释
 
    struct __as_sentinel{};             // 仅用于阐释
 
  public:
    adjacent_view() requires default_initializable<V> = default;
    constexpr explicit adjacent_view(V base);
 
    constexpr auto begin() requires (!__simple_view<V>) {
      return iterator<false>(ranges::begin(base_), ranges::end(base_));
    }
 
    constexpr auto begin() const requires range<const V> {
      return iterator<true>(ranges::begin(base_), ranges::end(base_));
    }
 
    constexpr auto end() requires (!__simple_view<V>) {
      if constexpr (common_range<V>) {
        return iterator<false>(__as_sentinel{}, ranges::begin(base_), ranges::end(base_));
      } else {
        return sentinel<false>(ranges::end(base_));
      }
    }
 
    constexpr auto end() const requires range<const V> {
      if constexpr (common_range<const V>) {
        return iterator<true>(__as_sentinel{}, ranges::begin(base_), ranges::end(base_));
      } else {
        return sentinel<true>(ranges::end(base_));
      }
    }
 
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
  };
}

类模板 std::ranges::adjacent_view::iterator

namespace std::ranges {
  template<forward_range V, size_t N>
    requires view<V> && (N > 0)
  template<bool Const>
  class adjacent_view<V, N>::iterator {
    using Base = __maybe_const<Const, V>;                               // 仅用于阐释
    array<iterator_t<Base>, N> current_ = array<iterator_t<Base>, N>(); // 仅用于阐释
    constexpr iterator(iterator_t<Base> first, sentinel_t<Base> last);  // 仅用于阐释
    constexpr iterator(__as_sentinel, iterator_t<Base> first, iterator_t<Base> last);
                                                                        // 仅用于阐释
  public:
    using iterator_category = input_iterator_tag;
    using iterator_concept  = /* 见描述 */;
    using value_type = tuple<__REPEAT(range_value_t<Base>, N)...>;
    using difference_type = range_difference_t<Base>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
 
    constexpr auto operator*() const;
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type x)
      requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x)
      requires random_access_range<Base>;
 
    constexpr auto operator[](difference_type n) const
      requires random_access_range<Base>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> &&
               three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
 
    friend constexpr auto iter_move(const iterator& i) noexcept(/* 见描述 */);
    friend constexpr void iter_swap(const iterator& l,
                                    const iterator& r) noexcept(/* 见描述 */)
      requires indirectly_swappable<iterator_t<Base>>;
  };
}

类模板 std::ranges::adjacent_view::sentinel

namespace std::ranges {
  template<forward_range V, size_t N>
    requires view<V> && (N > 0)
  template<bool Const>
  class adjacent_view<V, N>::sentinel {
    using Base = __maybe_const<Const, V>;                       // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();                 // 仅用于阐释
    constexpr explicit sentinel(sentinel_t<Base> end);          // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> i)
      requires Const && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    template<bool OtherConst>
      requires sentinel_for<sentinel_t<Base>, iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<sentinel_t<Base>,
        iterator_t<__maybe_const<OtherConst, V>>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, V>>
      operator-(const sentinel& y, const iterator<OtherConst>& x);
  };
}

类模板 std::ranges::adjacent_transform_view

namespace std::ranges {
  template<forward_range V, move_constructible F, size_t N>
    requires view<V> && (N > 0) && is_object_v<F> &&
             regular_invocable<F&, __REPEAT(range_reference_t<V>, N)...> &&
             __can_reference<invoke_result_t<F&, __REPEAT(range_reference_t<V>, N)...>>
  class adjacent_transform_view :
    public view_interface<adjacent_transform_view<V, F, N>> {
    __movable_box<F> fun_;                      // 仅用于阐释
    adjacent_view<V, N> inner_;                 // 仅用于阐释
 
    using InnerView = adjacent_view<V, N>;      // 仅用于阐释
    template<bool Const>
      using __inner_iterator =
        iterator_t<__maybe_const<Const, InnerView>>;    // 仅用于阐释
    template<bool Const>
      using __inner_sentinel =
        sentinel_t<__maybe_const<Const, InnerView>>;    // 仅用于阐释
 
    // 类 template adjacent_transform_view::iterator
    template<bool> class iterator;              // 仅用于阐释
 
    // 类 template adjacent_transform_view::sentinel
    template<bool> class sentinel;              // 仅用于阐释
 
  public:
    adjacent_transform_view() = default;
    constexpr explicit adjacent_transform_view(V base, F fun);
 
    constexpr auto begin() {
      return iterator<false>(*this, inner_.begin());
    }
 
    constexpr auto begin() const
      requires range<const InnerView> &&
               regular_invocable<const F&, __REPEAT(range_reference_t<const V>, N)...> {
      return iterator<true>(*this, inner_.begin());
    }
 
    constexpr auto end() {
      if constexpr (common_range<InnerView>) {
        return iterator<false>(*this, inner_.end());
      } else {
        return sentinel<false>(inner_.end());
      }
    }
 
    constexpr auto end() const
      requires range<const InnerView> &&
               regular_invocable<const F&, __REPEAT(range_reference_t<const V>, N)...> {
      if constexpr (common_range<const InnerView>) {
        return iterator<true>(*this, inner_.end());
      } else {
        return sentinel<true>(inner_.end());
      }
    }
 
    constexpr auto size() requires sized_range<InnerView> {
      return inner_.size();
    }
 
    constexpr auto size() const requires sized_range<const InnerView> {
      return inner_.size();
    }
  };
}

类模板 std::ranges::adjacent_transform_view::iterator

namespace std::ranges {
  template<forward_range V, move_constructible F, size_t N>
    requires view<V> && (N > 0) && is_object_v<F> &&
             regular_invocable<F&, __REPEAT(range_reference_t<V>, N)...> &&
             __can_reference<invoke_result_t<F&, __REPEAT(range_reference_t<V>, N)...>>
  template<bool Const>
  class adjacent_transform_view<V, F, N>::iterator {
    using Parent = __maybe_const<Const, adjacent_transform_view>;       // 仅用于阐释
    using Base = __maybe_const<Const, V>;                               // 仅用于阐释
    Parent* parent_ = nullptr;                                          // 仅用于阐释
    __inner_iterator<Const> inner_;                                     // 仅用于阐释
 
    constexpr iterator(Parent& parent, __inner_iterator<Const> inner);  // 仅用于阐释
 
  public:
    using iterator_category = /* 见描述 */;
    using iterator_concept  = typename __inner_iterator<Const>::iterator_concept;
    using value_type =
      remove_cvref_t<invoke_result_t<__maybe_const<Const, F>&,
                                     __REPEAT(range_reference_t<Base>, N)...>>;
    using difference_type = range_difference_t<Base>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<__inner_iterator<false>, __inner_iterator<Const>>;
 
    constexpr decltype(auto) operator*() const noexcept(/* 见描述 */);
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
    constexpr iterator& operator+=(difference_type x) requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x) requires random_access_range<Base>;
 
    constexpr decltype(auto) operator[](difference_type n) const
      requires random_access_range<Base>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> && three_way_comparable<__inner_iterator<Const>>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<__inner_iterator<Const>, __inner_iterator<Const>>;
  };
}

类模板 std::ranges::adjacent_transform_view::sentinel

namespace std::ranges {
  template<forward_range V, move_constructible F, size_t N>
    requires view<V> && (N > 0) && is_object_v<F> &&
             regular_invocable<F&, __REPEAT(range_reference_t<V>, N)...> &&
             __can_reference<invoke_result_t<F&, __REPEAT(range_reference_t<V>, N)...>>
  template<bool Const>
  class adjacent_transform_view<V, F, N>::sentinel {
    __inner_sentinel<Const> inner_;                               // 仅用于阐释
    constexpr explicit sentinel(__inner_sentinel<Const> inner);   // 仅用于阐释
 
  public:
    sentinel() = default;
    constexpr sentinel(sentinel<!Const> i)
      requires Const && convertible_to<__inner_sentinel<false>, __inner_sentinel<Const>>;
 
    template<bool OtherConst>
      requires sentinel_for<__inner_sentinel<Const>, __inner_iterator<OtherConst>>
    friend constexpr bool operator==(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<__inner_sentinel<Const>, __inner_iterator<OtherConst>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, InnerView>>
      operator-(const iterator<OtherConst>& x, const sentinel& y);
 
    template<bool OtherConst>
      requires sized_sentinel_for<__inner_sentinel<Const>, __inner_iterator<OtherConst>>
    friend constexpr range_difference_t<__maybe_const<OtherConst, InnerView>>
      operator-(const sentinel& x, const iterator<OtherConst>& y);
  };
}

类模板 std::ranges::chunk_view for input_ranges

namespace std::ranges {
  template<class I>
  constexpr I __div_ceil(I num, I denom) {                  // 仅用于阐释
    I r = num / denom;
    if (num % denom)
      ++r;
    return r;
  }
 
  template<view V>
    requires input_range<V>
  class chunk_view : public view_interface<chunk_view<V>> {
    V base_;                                                // 仅用于阐释
    range_difference_t<V> n_;                               // 仅用于阐释
    range_difference_t<V> remainder_ = 0;                   // 仅用于阐释
 
    __non_propagating_cache<iterator_t<V>> current_;        // 仅用于阐释
 
    // 类 chunk_view::outer-iterator
    class __outer_iterator;                                 // 仅用于阐释
 
    // 类 chunk_view::inner-iterator
    class __inner_iterator;                                 // 仅用于阐释
 
  public:
    constexpr explicit chunk_view(V base, range_difference_t<V> n);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr __outer_iterator begin();
    constexpr default_sentinel_t end() const noexcept;
 
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
  };
 
  template<class R>
    chunk_view(R&&, range_difference_t<R>) -> chunk_view<views::all_t<R>>;
}

类模板 std::ranges::chunk_view::outer_iterator for input_ranges

namespace std::ranges {
  template<view V>
    requires input_range<V>
  class chunk_view<V>::__outer_iterator {
    chunk_view* parent_;                                        // 仅用于阐释
 
    constexpr explicit __outer_iterator(chunk_view& parent);    // 仅用于阐释
 
  public:
    using iterator_concept = input_iterator_tag;
    using difference_type  = range_difference_t<V>;
 
    // 类 chunk_view::outer-iterator::value_type
    struct value_type;
 
    __outer_iterator(__outer_iterator&&) = default;
    __outer_iterator& operator=(__outer_iterator&&) = default;
 
    constexpr value_type operator*() const;
    constexpr __outer_iterator& operator++();
    constexpr void operator++(int);
 
    friend constexpr bool operator==(const __outer_iterator& x, default_sentinel_t);
 
    friend constexpr difference_type operator-(default_sentinel_t y,
                                               const __outer_iterator& x)
      requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
    friend constexpr difference_type operator-(const __outer_iterator& x,
                                               default_sentinel_t y)
      requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
  };
}

类模板 std::ranges::chunk_view::outer_iterator::value_type for input_ranges

namespace std::ranges {
  template<view V>
    requires input_range<V>
  struct chunk_view<V>::__outer_iterator::value_type : view_interface<value_type> {
  private:
    chunk_view* parent_;                                        // 仅用于阐释
 
    constexpr explicit value_type(chunk_view& parent);          // 仅用于阐释
 
  public:
    constexpr __inner_iterator begin() const noexcept;
    constexpr default_sentinel_t end() const noexcept;
 
    constexpr auto size() const
      requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
  };
}

类模板 std::ranges::chunk_view::inner_iterator for input_ranges

namespace std::ranges {
  template<view V>
    requires input_range<V>
  class chunk_view<V>::__inner_iterator {
    chunk_view* parent_;                                                // 仅用于阐释
 
    constexpr explicit __inner_iterator(chunk_view& parent) noexcept;   // 仅用于阐释
 
  public:
    using iterator_concept = input_iterator_tag;
    using difference_type = range_difference_t<V>;
    using value_type = range_value_t<V>;
 
    __inner_iterator(__inner_iterator&&) = default;
    __inner_iterator& operator=(__inner_iterator&&) = default;
 
    constexpr const iterator_t<V>& base() const &;
 
    constexpr range_reference_t<V> operator*() const;
    constexpr __inner_iterator& operator++();
    constexpr void operator++(int);
 
    friend constexpr bool operator==(const __inner_iterator& x, default_sentinel_t);
 
    friend constexpr difference_type operator-(default_sentinel_t y,
                                               const __inner_iterator& x)
      requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
    friend constexpr difference_type operator-(const __inner_iterator& x,
                                               default_sentinel_t y)
      requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
  };
}

类模板 std::ranges::chunk_view for forward_ranges

namespace std::ranges {
  template<view V>
    requires forward_range<V>
  class chunk_view<V> : public view_interface<chunk_view<V>> {
    V base_;                            // 仅用于阐释
    range_difference_t<V> n_;           // 仅用于阐释
 
    //类模板 chunk_view::iterator
    template<bool> class iterator;      // 仅用于阐释
 
  public:
    constexpr explicit chunk_view(V base, range_difference_t<V> n);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr auto begin() requires (!__simple_view<V>) {
      return iterator<false>(this, ranges::begin(base_));
    }
 
    constexpr auto begin() const requires forward_range<const V> {
      return iterator<true>(this, ranges::begin(base_));
    }
 
    constexpr auto end() requires (!__simple_view<V>) {
      if constexpr (common_range<V> && sized_range<V>) {
        auto missing = (n_ - ranges::distance(base_) % n_) % n_;
        return iterator<false>(this, ranges::end(base_), missing);
      } else if constexpr (common_range<V> && !bidirectional_range<V>) {
        return iterator<false>(this, ranges::end(base_));
      } else {
        return default_sentinel;
      }
    }
 
    constexpr auto end() const requires forward_range<const V> {
      if constexpr (common_range<const V> && sized_range<const V>) {
        auto missing = (n_ - ranges::distance(base_) % n_) % n_;
        return iterator<true>(this, ranges::end(base_), missing);
      } else if constexpr (common_range<const V> && !bidirectional_range<const V>) {
        return iterator<true>(this, ranges::end(base_));
      } else {
        return default_sentinel;
      }
    }
 
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
  };
}

类模板 std::ranges::chunk_view::iterator for forward_ranges

namespace std::ranges {
  template<view V>
    requires forward_range<V>
  template<bool Const>
  class chunk_view<V>::iterator {
    using Parent = __maybe_const<Const, chunk_view>;                    // 仅用于阐释
    using Base = __maybe_const<Const, V>;                               // 仅用于阐释
 
    iterator_t<Base> current_ = iterator_t<Base>();                     // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();                         // 仅用于阐释
    range_difference_t<Base> n_ = 0;                                    // 仅用于阐释
    range_difference_t<Base> missing_ = 0;                              // 仅用于阐释
 
    constexpr iterator(Parent* parent, iterator_t<Base> current,        // 仅用于阐释
                       range_difference_t<Base> missing = 0);
 
  public:
    using iterator_category = input_iterator_tag;
    using iterator_concept = /* 见描述 */;
    using value_type = decltype(views::take(subrange(current_, end_), n_));
    using difference_type = range_difference_t<Base>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>
                     && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr iterator_t<Base> base() const;
 
    constexpr value_type operator*() const;
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type x)
      requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x)
      requires random_access_range<Base>;
 
    constexpr value_type operator[](difference_type n) const
      requires random_access_range<Base>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
    friend constexpr bool operator==(const iterator& x, default_sentinel_t);
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> &&
               three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
 
    friend constexpr difference_type operator-(default_sentinel_t y, const iterator& x)
      requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
    friend constexpr difference_type operator-(const iterator& x, default_sentinel_t y)
      requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
  };
}

类模板 std::ranges::slide_view

namespace std::ranges {
  template<class V>
  concept __slide_caches_nothing = random_access_range<V> &&
    sized_range<V>;                                             // 仅用于阐释
 
  template<class V>
  concept __slide_caches_last =                                 // 仅用于阐释
    !__slide_caches_nothing<V> && bidirectional_range<V> && common_range<V>;
 
  template<class V>
  concept __slide_caches_first =                                // 仅用于阐释
    !__slide_caches_nothing<V> && !__slide_caches_last<V>;
 
  template<forward_range V>
    requires view<V>
  class slide_view : public view_interface<slide_view<V>> {
    V base_;                            // 仅用于阐释
    range_difference_t<V> n_;           // 仅用于阐释
 
    //类模板 slide_view::iterator
    template<bool> class iterator;      // 仅用于阐释
 
    // 类 slide_view::sentinel
    class sentinel;                     // 仅用于阐释
 
  public:
    constexpr explicit slide_view(V base, range_difference_t<V> n);
 
    constexpr auto begin()
      requires (!(__simple_view<V> && __slide_caches_nothing<const V>));
    constexpr auto begin() const requires __slide_caches_nothing<const V>;
 
    constexpr auto end()
      requires (!(__simple_view<V> && __slide_caches_nothing<const V>));
    constexpr auto end() const requires __slide_caches_nothing<const V>;
 
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
  };
 
  template<class R>
    slide_view(R&&, range_difference_t<R>) -> slide_view<views::all_t<R>>;
}

类模板 std::ranges::slide_view::iterator

namespace std::ranges {
  template<forward_range V>
    requires view<V>
  template<bool Const>
  class slide_view<V>::iterator {
    using Base = __maybe_const<Const, V>;               // 仅用于阐释
    iterator_t<Base> current_   = iterator_t<Base>();   // 仅用于阐释
    iterator_t<Base> last_ele_  = iterator_t<Base>();   // 仅用于阐释,
                                    // 仅当 Base 实现 slide-caches-first 时存在
    range_difference_t<Base> n_ = 0;                    // 仅用于阐释
 
    constexpr iterator(iterator_t<Base> current,        // 仅用于阐释
                       range_difference_t<Base> n)
      requires (!__slide_caches_first<Base>);
 
    constexpr iterator(iterator_t<Base> current,        // 仅用于阐释
                       iterator_t<Base> last_ele,
                       range_difference_t<Base> n)
      requires __slide_caches_first<Base>;
 
  public:
    using iterator_category = input_iterator_tag;
    using iterator_concept = /* 见描述 */;
    using value_type = decltype(views::counted(current_, n_));
    using difference_type = range_difference_t<Base>;
 
    iterator() = default;
    constexpr iterator(iterator<!Const> i)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>;
 
    constexpr auto operator*() const;
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type x)
      requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type x)
      requires random_access_range<Base>;
 
    constexpr auto operator[](difference_type n) const
      requires random_access_range<Base>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> &&
               three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& i)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& i, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
  };
}

类模板 std::ranges::slide_view::sentinel

namespace std::ranges {
  template<forward_range V>
    requires view<V>
  class slide_view<V>::sentinel {
    sentinel_t<V> end_ = sentinel_t<V>();             // 仅用于阐释
    constexpr explicit sentinel(sentinel_t<V> end);   // 仅用于阐释
 
  public:
    sentinel() = default;
 
    friend constexpr bool operator==(const iterator<false>& x, const sentinel& y);
 
    friend constexpr range_difference_t<V>
      operator-(const iterator<false>& x, const sentinel& y)
        requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
 
    friend constexpr range_difference_t<V>
      operator-(const sentinel& y, const iterator<false>& x)
        requires sized_sentinel_for<sentinel_t<V>, iterator_t<V>>;
  };
}

类模板 std::ranges::chunk_by_view

namespace std::ranges {
  template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class chunk_by_view : public view_interface<chunk_by_view<V, Pred>> {
    V base_ = V();                                          // 仅用于阐释
    __movable_box<Pred> pred_ = Pred();                     // 仅用于阐释
 
    // 类 chunk_by_view::iterator
    class iterator;                                         // 仅用于阐释
 
  public:
    chunk_by_view() requires default_initializable<V> &&
        default_initializable<Pred> = default;
    constexpr explicit chunk_by_view(V base, Pred pred);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr const Pred& pred() const;
 
    constexpr iterator begin();
    constexpr auto end();
 
    constexpr iterator_t<V> __find_next(iterator_t<V>);       // 仅用于阐释
    constexpr iterator_t<V> __find_prev(iterator_t<V>)        // 仅用于阐释
      requires bidirectional_range<V>;
  };
 
  template<class R, class Pred>
    chunk_by_view(R&&, Pred) -> chunk_by_view<views::all_t<R>, Pred>;
}

类模板 std::ranges::chunk_by_view::iterator

namespace std::ranges {
  template<forward_range V, indirect_binary_predicate<iterator_t<V>, iterator_t<V>> Pred>
    requires view<V> && is_object_v<Pred>
  class chunk_by_view<V, Pred>::iterator {
    chunk_by_view* parent_ = nullptr;                                   // 仅用于阐释
    iterator_t<V> current_ = iterator_t<V>();                           // 仅用于阐释
    iterator_t<V> next_    = iterator_t<V>();                           // 仅用于阐释
 
    constexpr iterator(chunk_by_view& parent, iterator_t<V> current,    // 仅用于阐释
                       iterator_t<V> next);
 
  public:
    using value_type = subrange<iterator_t<V>>;
    using difference_type  = range_difference_t<V>;
    using iterator_category = input_iterator_tag;
    using iterator_concept = /* 见描述 */;
 
    iterator() = default;
 
    constexpr value_type operator*() const;
    constexpr iterator& operator++();
    constexpr iterator operator++(int);
 
    constexpr iterator& operator--() requires bidirectional_range<V>;
    constexpr iterator operator--(int) requires bidirectional_range<V>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y);
    friend constexpr bool operator==(const iterator& x, default_sentinel_t);
  };
}

类模板 std::ranges::stride_view

namespace std::ranges {
  template<input_range V>
    requires view<V>
  class stride_view : public view_interface<stride_view<V>> {
    V base_;                                    // 仅用于阐释
    range_difference_t<V> stride_;              // 仅用于阐释
    //类模板 stride_view::iterator
    template<bool> class iterator;              // 仅用于阐释
  public:
    constexpr explicit stride_view(V base, range_difference_t<V> stride);
 
    constexpr V base() const & requires copy_constructible<V> { return base_; }
    constexpr V base() && { return std::move(base_); }
 
    constexpr range_difference_t<V> stride() const noexcept;
 
    constexpr auto begin() requires (!__simple_view<V>) {
      return iterator<false>(this, ranges::begin(base_));
    }
 
    constexpr auto begin() const requires range<const V> {
      return iterator<true>(this, ranges::begin(base_));
    }
 
    constexpr auto end() requires (!__simple_view<V>) {
      if constexpr (common_range<V> && sized_range<V> && forward_range<V>) {
        auto missing = (stride_ - ranges::distance(base_) % stride_) % stride_;
        return iterator<false>(this, ranges::end(base_), missing);
      } else if constexpr (common_range<V> && !bidirectional_range<V>) {
        return iterator<false>(this, ranges::end(base_));
      } else {
        return default_sentinel;
      }
    }
 
    constexpr auto end() const requires range<const V> {
      if constexpr (common_range<const V> && sized_range<const V> &&
          forward_range<const V>) {
        auto missing = (stride_ - ranges::distance(base_) % stride_) % stride_;
        return iterator<true>(this, ranges::end(base_), missing);
      } else if constexpr (common_range<const V> && !bidirectional_range<const V>) {
        return iterator<true>(this, ranges::end(base_));
      } else {
        return default_sentinel;
      }
    }
 
    constexpr auto size() requires sized_range<V>;
    constexpr auto size() const requires sized_range<const V>;
  };
 
  template<class R>
    stride_view(R&&, range_difference_t<R>) -> stride_view<views::all_t<R>>;
}

类模板 std::ranges::stride_view::iterator

namespace std::ranges {
  template<input_range V>
    requires view<V>
  template<bool Const>
  class stride_view<V>::iterator {
    using Parent = __maybe_const<Const, stride_view>;               // 仅用于阐释
    using Base = __maybe_const<Const, V>;                           // 仅用于阐释
 
    iterator_t<Base> current_ = iterator_t<Base>();                 // 仅用于阐释
    sentinel_t<Base> end_ = sentinel_t<Base>();                     // 仅用于阐释
    range_difference_t<Base> stride_ = 0;                           // 仅用于阐释
    range_difference_t<Base> missing_ = 0;                          // 仅用于阐释
 
    constexpr iterator(Parent* parent, iterator_t<Base> current,    // 仅用于阐释
                       range_difference_t<Base> missing = 0);
  public:
    using difference_type = range_difference_t<Base>;
    using value_type = range_value_t<Base>;
    using iterator_concept = /* 见描述 */;
    using iterator_category = /* 见描述 */;    // 不总存在
 
    iterator() requires default_initializable<iterator_t<Base>> = default;
 
    constexpr iterator(iterator<!Const> other)
      requires Const && convertible_to<iterator_t<V>, iterator_t<Base>>
                     && convertible_to<sentinel_t<V>, sentinel_t<Base>>;
 
    constexpr iterator_t<Base> base() &&;
    constexpr const iterator_t<Base>& base() const & noexcept;
 
    constexpr decltype(auto) operator*() const { return *current_; }
 
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int) requires forward_range<Base>;
 
    constexpr iterator& operator--() requires bidirectional_range<Base>;
    constexpr iterator operator--(int) requires bidirectional_range<Base>;
 
    constexpr iterator& operator+=(difference_type n) requires random_access_range<Base>;
    constexpr iterator& operator-=(difference_type n) requires random_access_range<Base>;
 
    constexpr decltype(auto) operator[](difference_type n) const
      requires random_access_range<Base>
    { return *(*this + n); }
 
    friend constexpr bool operator==(const iterator& x, default_sentinel_t);
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<iterator_t<Base>>;
 
    friend constexpr bool operator<(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
 
    friend constexpr bool operator>(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
 
    friend constexpr bool operator<=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
 
    friend constexpr bool operator>=(const iterator& x, const iterator& y)
      requires random_access_range<Base>;
 
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires random_access_range<Base> && three_way_comparable<iterator_t<Base>>;
 
    friend constexpr iterator operator+(const iterator& x, difference_type n)
      requires random_access_range<Base>;
    friend constexpr iterator operator+(difference_type n, const iterator& x)
      requires random_access_range<Base>;
    friend constexpr iterator operator-(const iterator& x, difference_type n)
      requires random_access_range<Base>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires sized_sentinel_for<iterator_t<Base>, iterator_t<Base>>;
 
    friend constexpr difference_type operator-(default_sentinel_t y, const iterator& x)
      requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
    friend constexpr difference_type operator-(const iterator& x, default_sentinel_t y)
      requires sized_sentinel_for<sentinel_t<Base>, iterator_t<Base>>;
 
    friend constexpr range_rvalue_reference_t<Base> iter_move(const iterator& i)
      noexcept(noexcept(ranges::iter_move(i.current_)));
 
    friend constexpr void iter_swap(const iterator& x, const iterator& y)
      noexcept(noexcept(ranges::iter_swap(x.current_, y.current_)))
      requires indirectly_swappable<iterator_t<Base>>;
  };
}

类模板 std::ranges::cartesian_product_view

namespace std::ranges {
  template<bool Const, class First, class... Vs>
  concept __cartesian_product_is_random_access =          // 仅用于阐释
    (random_access_range<__maybe_const<Const, First>> && ... &&
      (random_access_range<__maybe_const<Const, Vs>>
        && sized_range<__maybe_const<Const, Vs>>));
 
  template<class R>
  concept __cartesian_product_common_arg =                // 仅用于阐释
    common_range<R> || (sized_range<R> && random_access_range<R>);
 
  template<bool Const, class First, class... Vs>
  concept __cartesian_product_is_bidirectional =          // 仅用于阐释
    (bidirectional_range<__maybe_const<Const, First>> && ... &&
      (bidirectional_range<__maybe_const<Const, Vs>>
        && __cartesian_product_common_arg<__maybe_const<Const, Vs>>));
 
  template<class First, class... Vs>
  concept __cartesian_product_is_common =                 // 仅用于阐释
    __cartesian_product_common_arg<First>;
 
  template<class... Vs>
  concept __cartesian_product_is_sized =                  // 仅用于阐释
    (sized_range<Vs> && ...);
 
  template<bool Const, template<class> class FirstSent, class First, class... Vs>
    concept __cartesian_is_sized_sentinel =               // 仅用于阐释
      (sized_sentinel_for<FirstSent<__maybe_const<Const, First>>,
          iterator_t<__maybe_const<Const, First>>> && ...
        && (sized_range<__maybe_const<Const, Vs>>
          && sized_sentinel_for<iterator_t<__maybe_const<Const, Vs>>,
              iterator_t<__maybe_const<Const, Vs>>>));
 
  template<__cartesian_product_common_arg R>
  constexpr auto __cartesian_common_arg_end(R& r) {       // 仅用于阐释
    if constexpr (common_range<R>) {
      return ranges::end(r);
    } else {
      return ranges::begin(r) + ranges::distance(r);
    }
  }
 
  template<input_range First, forward_range... Vs>
    requires (view<First> && ... && view<Vs>)
  class cartesian_product_view :
    public view_interface<cartesian_product_view<First, Vs...>> {
  private:
    tuple<First, Vs...> bases_;                 // 仅用于阐释
    //类模板 cartesian_product_view::iterator
    template<bool Const> class iterator;       // 仅用于阐释
  public:
    constexpr cartesian_product_view() = default;
    constexpr explicit cartesian_product_view(First first_base, Vs... bases);
 
    constexpr iterator<false> begin()
      requires (!__simple_view<First> || ... || !__simple_view<Vs>);
    constexpr iterator<true> begin() const
      requires (range<const First> && ... && range<const Vs>);
 
    constexpr iterator<false> end()
      requires ((!__simple_view<First> || ... || !__simple_view<Vs>) &&
        __cartesian_product_is_common<First, Vs...>);
    constexpr iterator<true> end() const
      requires __cartesian_product_is_common<const First, const Vs...>;
    constexpr default_sentinel_t end() const noexcept;
 
    constexpr /* 见描述 */ size()
      requires __cartesian_product_is_sized<First, Vs...>;
    constexpr /* 见描述 */ size() const
      requires __cartesian_product_is_sized<const First, const Vs...>;
  };
 
  template<class... Vs>
    cartesian_product_view(Vs&&...) -> cartesian_product_view<all_t<Vs>...>;
}

类模板 std::ranges::cartesian_product_view::iterator

namespace std::ranges {
  template<input_range First, forward_range... Vs>
    requires (view<First> && ... && view<Vs>)
  template<bool Const>
  class cartesian_product_view<First, Vs...>::iterator {
  public:
    using iterator_category = input_iterator_tag;
    using iterator_concept  = /* 见描述 */;
    using value_type = tuple<range_value_t<__maybe_const<Const, First>>,
      range_value_t<__maybe_const<Const, Vs>>...>;
    using reference = tuple<range_reference_t<__maybe_const<Const, First>>,
      range_reference_t<__maybe_const<Const, Vs>>...>;
    using difference_type = /* 见描述 */;
 
    iterator() requires forward_range<__maybe_const<Const, First>> = default;
 
    constexpr iterator(iterator<!Const> i) requires Const &&
      (convertible_to<iterator_t<First>, iterator_t<const First>> &&
        ... && convertible_to<iterator_t<Vs>, iterator_t<const Vs>>);
 
    constexpr auto operator*() const;
    constexpr iterator& operator++();
    constexpr void operator++(int);
    constexpr iterator operator++(int)
      requires forward_range<__maybe_const<Const, First>>;
 
    constexpr iterator& operator--()
      requires __cartesian_product_is_bidirectional<Const, First, Vs...>;
    constexpr iterator operator--(int)
      requires __cartesian_product_is_bidirectional<Const, First, Vs...>;
 
    constexpr iterator& operator+=(difference_type x)
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
    constexpr iterator& operator-=(difference_type x)
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
 
    constexpr reference operator[](difference_type n) const
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
 
    friend constexpr bool operator==(const iterator& x, const iterator& y)
      requires equality_comparable<iterator_t<__maybe_const<Const, First>>>;
 
    friend constexpr bool operator==(const iterator& x, default_sentinel_t);
 
    friend constexpr auto operator<=>(const iterator& x, const iterator& y)
      requires __all_random_access<Const, First, Vs...>;
 
    friend constexpr iterator operator+(const iterator& x, difference_type y)
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
    friend constexpr iterator operator+(difference_type x, const iterator& y)
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
    friend constexpr iterator operator-(const iterator& x, difference_type y)
      requires __cartesian_product_is_random_access<Const, First, Vs...>;
    friend constexpr difference_type operator-(const iterator& x, const iterator& y)
      requires __cartesian_is_sized_sentinel<Const, iterator_t, First, Vs...>;
 
    friend constexpr difference_type operator-(iterator i, default_sentinel_t)
      requires __cartesian_is_sized_sentinel<Const, sentinel_t, First, Vs...>;
    friend constexpr difference_type operator-(default_sentinel_t, iterator i)
      requires __cartesian_is_sized_sentinel<Const, sentinel_t, First, Vs...>;
 
    friend constexpr auto iter_move(const iterator& i) noexcept(/* 见描述 */);
 
    friend constexpr void iter_swap(const iterator& l, const iterator& r)
        noexcept(/* 见描述 */)
      requires (indirectly_swappable<iterator_t<__maybe_const<Const, First>>> && ... &&
        indirectly_swappable<iterator_t<__maybe_const<Const, Vs>>>);
 
  private:
    __maybe_const<Const, cartesian_product_view>* parent_ = nullptr;  // 仅用于阐释
    tuple<iterator_t<__maybe_const<Const, First>>,
      iterator_t<__maybe_const<Const, Vs>>...> current_;              // 仅用于阐释
 
    template<size_t N = sizeof...(Vs)>
      constexpr void next();                                          // 仅用于阐释
 
    template<size_t N = sizeof...(Vs)>
      constexpr void prev();                                          // 仅用于阐释
 
    template<class Tuple>
      constexpr difference_type __distance_from(Tuple t);             // 仅用于阐释
 
    constexpr explicit iterator(tuple<iterator_t<__maybe_const<Const, First>>,
      iterator_t<__maybe_const<Const, Vs>>...> current);              // 仅用于阐释
  };
}