Namespaces
Variants

std::ranges::adjacent_view<V,N>:: begin

From cppreference.net
Ranges library
Range adaptors
constexpr auto begin ( ) requires ( ! __SimpleView < V > ) ;
(1) (C++23 이후)
constexpr auto begin ( ) const requires ranges:: range < const V > ;
(2) (C++23 이후)

iterator adjacent_view 의 첫 번째 요소로 반환합니다.

base_ 를 기본 뷰로 설정합니다.

1) 다음과 동일함 return /*iterator*/ < false > ( ranges:: begin ( base_ ) , ranges:: end ( base_ ) ) ; .
2) 다음에 해당함 return /*iterator*/ < true > ( ranges:: begin ( base_ ) , ranges:: end ( base_ ) ) ; .

목차

매개변수

(없음)

반환값

첫 번째 요소에 대한 반복자.

예제

#include <ranges>
#include <tuple>
#include <type_traits>
int main()
{
    constexpr static auto v = {'A', 'B', 'C', 'D', 'E'};
    constexpr auto view = std::views::adjacent<3>(v);
    constexpr auto tuple = *view.begin();
    static_assert
    (
        std::is_same_v
        <
            decltype(tuple),
            const std::tuple<char const&, char const&, char const&>
        >
    );
    static_assert
    (
        std::get<0>(tuple) == 'A' &&
        std::get<1>(tuple) == 'B' &&
        std::get<2>(tuple) == 'C'
    );
}

참고 항목

끝을 가리키는 반복자 또는 센티널을 반환합니다
(public member function)
범위의 시작을 가리키는 반복자를 반환합니다
(customization point object)