命名空间
变体
操作

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

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

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

等价于: return *current_;

内容

[edit] 参数

(无)

[edit] 返回值

当前元素。

[edit] 注解

operator-> 未提供。

[edit] 示例

#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');
}

[edit] 参见

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