Namespaces
Variants

std::ranges::adjacent_view<V,N>:: iterator <Const>:: operator*

From cppreference.net
Ranges library
Range adaptors
constexpr auto operator * ( ) const ;
(C++23以降)

イテレータが指す基盤配列の要素を V に返します。

current_ を基盤となるイテレータの配列とする。

同等の機能:

return /*タプル変換*/([](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});
}

関連項目

(C++23)
インデックスによる要素へのアクセス
(公開メンバ関数)