Namespaces
Variants

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

cppreference.net에서
 
 
범위 라이브러리
범위 어댑터
 
 
constexpr auto begin() requires (!__SimpleView<V>);
(1) (C++23부터)
constexpr auto begin() const requires ranges::range<const V>;
(2) (C++23부터)

반복자를 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)