Namespaces
Variants

std::ranges::adjacent_transform_view<V,F,N>:: begin

From cppreference.net
Ranges library
Range adaptors
constexpr auto begin ( ) ;
(1) (自 C++23 起)
constexpr auto begin ( ) const

requires ranges:: range < const InnerView > &&
std:: regular_invocable < const F & ,

/*REPEAT*/ ( ranges:: range_reference_t < const V > , N ) ... > ;
(2) (自 C++23 起)

返回指向 adjacent_transform_view 首元素的 迭代器

inner_ 为底层的 ranges::adjacent_view

1) 等价于 return /*iterator*/ < false > ( * this, inner_. begin ( ) ) ;
2) 等价于 return /*iterator*/ < true > ( * this, inner_. begin ( ) ) ;

目录

参数

(无)

返回值

指向第一个元素的迭代器。

示例

#include <ranges>
int main()
{
    auto sum = [](auto... args) { return (... + args); };
    constexpr auto view = std::views::iota(13, 1337)
                        | std::views::adjacent_transform<3>(sum);
    static_assert(*view.begin() == 42 and 42 == 13 + 14 + 15);
}

参见

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