Namespaces
Variants

std::ranges::slide_view<V>:: end

From cppreference.net
Ranges library
Range adaptors
constexpr auto end ( )
requires ( ! ( /*simple-view*/ < V > && /*slide-caches-nothing*/ < const V > ) ) ;
(1) (C++23 起)
constexpr auto end ( ) const
requires /*slide-caches-nothing*/ < const V > ;
(2) (C++23 起)

返回表示 slide_view 末尾的 sentinel iterator

1) base_ n_ 为底层数据成员。等价于:
V 满足 slide-caches-last 概念,则此函数会将结果缓存于 cached_end_ 中供后续调用使用。此为实现 range 所要求的均摊常数时间复杂度所必需。
2) 等价于 begin ( ) + ranges:: range_difference_t < const V > ( size ( ) )

目录

参数

(无)

返回值

表示 slide_view 末尾的 哨位 迭代器

示例

#include <iostream>
#include <ranges>
int main()
{
    static constexpr auto source = {'A', 'B', 'C', 'D'};
    for (const auto subrange: source | std::views::slide(3))
    {
        std::cout << "[ ";
        for (auto it = subrange.begin(); it != subrange.end(); ++it)
            std::cout << *it << ' ';
        std::cout << "]\n";
    }
}

输出:

[ A B C ]
[ B C D ]

参见

返回指向起始位置的迭代器
(公开成员函数)
返回指向范围起始位置的迭代器
(定制点对象)
返回标识范围结束的哨兵
(定制点对象)