命名空间
变体
操作

std::ranges::stride_view<V>::iterator<Const>::operator*

来自 cppreference.cn
< cpp‎ | ranges‎ | stride view‎ | iterator
 
 
范围库 (Ranges library)
范围适配器 (Range adaptors)
 
 
constexpr decltype(auto) operator*() const;
(C++23 起)

返回底层迭代器 current_ 指向的元素到 V

等价于: return *current_;

目录

[编辑] 参数

(无)

[编辑] 返回值

当前元素。

[编辑] 注解

未提供 operator->

[编辑] 示例

#include <ranges>
 
int main()
{
    constexpr static auto v = {'a', 'b', 'c', 'd', 'e'};
    constexpr auto view{v | std::views::stride(2)};
    constexpr auto iter{view.begin() + 1};
    static_assert(*iter == 'c');
    static_assert(*(view.begin() + 2) == 'e');
}

[编辑] 参阅

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