命名空间
变体
操作

std::ranges::adjacent_view<V,N>::iterator<Const>::运算符*

来自 cppreference.cn
 
 
范围库
范围适配器
 
 
constexpr auto operator*() const;
(C++23 起)

返回底层迭代器数组所指向的元素。

current_ 为底层迭代器数组。

等价于

return /*tuple-transform*/([](auto& i) -> decltype(auto) { return *i; }, current_);

目录

[编辑] 参数

(无)

[编辑] 返回值

当前元素,它是指向底层元素的引用的 std::tuple

[编辑] 注释

operator-> 不提供。

[编辑] 示例

#include <ranges>
#include <tuple>
 
int main()
{
    constexpr static auto v = {0, 1, 2, 3, 4, 5};
    //                               └──┬──┘
    //                                  └─────────────────┐
    constexpr auto view {v | std::views::adjacent<3>}; // │
    constexpr auto iter {view.begin() + 2};            // │
    //              ┌────────────────────┬────────────────┘
    //              │                 ┌──┴──┐
    static_assert(*iter == std::tuple{2, 3, 4});
}

[编辑] 参见

通过索引访问元素
(公共成员函数)