Namespaces
Variants

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

cppreference.net에서
 
 
범위 라이브러리
범위 어댑터
 
 
constexpr auto operator*() const;
(C++23부터)

기본 반복자 배열이 가리키는V 요소를 반환합니다.

를 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});
}

참고 항목

(C++23)
인덱스로 요소에 접근
(public member function)