Namespaces
Variants

std::ranges::concat_view<Views...>:: iterator

From cppreference.net
Ranges library
Range adaptors
template < bool Const >
class /*iterator*/
(1) ( 설명 전용* )
헬퍼 개념
template < bool Const, class ... Rs >
concept /*concat-is-random-access*/ = /* 설명 참조 */ ;
(2) ( 설명 전용* )
template < bool Const, class ... Rs >
concept /*concat-is-bidirectional*/ = /* 설명 참조 */ ;
(3) ( 설명 전용* )
1) ranges:: concat_view < Views... > :: iterator begin() end() 가 반환하는 반복자의 타입입니다. ranges:: concat_view < Views... >
2) Fs Rs 의 마지막 요소를 제외한 모든 요소로 구성된 팩이라고 하자. 다음과 동일함:

template < bool Const, class ... Rs >
concept concat-is-random-access = // 설명 전용
all-random-access  < Const, Rs... > &&
( ranges:: common_range < maybe-const  < Const, Fs >> && ... ) ;

.
3) Fs Rs 의 마지막 요소를 제외한 모든 요소로 구성된 팩이라고 하자. 다음 표현과 동치이다:

template < bool Const, class ... Rs >
concept concat-is-bidirectional = // 설명 전용
all-bidirectional  < Const, Rs... > &&
( ranges:: common_range < maybe-const  < Const, Fs >> && ... ) ;

.

목차

템플릿 매개변수

Const - 반복자가 상수 반복자인지 여부

중첩 타입

설명 전용 타입
타입 정의
base-iter std:: variant < ranges:: iterator_t < maybe-const  < Const, Views >> ... >
( 설명 전용 멤버 타입* )
반복자 속성 타입
타입 정의
iterator_concept 반복자 태그 , 아래 참조
iterator_category
(조건부 존재)
반복자 태그, 아래 참조
value_type concat-value-t  < maybe-const  < Const, Views > ... >
difference_type

std:: common_type_t < ranges:: range_difference_t < maybe-const  < Const, Views >> ... >

반복자 개념 결정

iterator_concept 는 다음과 같이 정의됩니다:

반복자 카테고리 결정

iterator_category all-forward  < Const, Views... > 가 모델링된 경우에만 정의됩니다. 이 경우 다음과 같이 정의됩니다:

데이터 멤버

멤버 정의
maybe-const  < Const, ranges:: concat_view > * parent_ 부모 concat_view 에 대한 포인터
( 설명 전용 멤버 객체* )
base-iter it_ 현재 뷰를 가리키는 반복자
( 설명 전용 멤버 객체* )

멤버 함수

반복자를 생성합니다
(public member function)
요소에 접근합니다
(public member function)
인덱스로 요소에 접근합니다
(public member function)
기본 반복자를 전진시키거나 후퇴시킵니다
(public member function)
설명 전용 함수 템플릿
it_ 가 현재 뷰의 끝이면 다음 뷰의 시작으로 it_ 를 대체합니다
( 설명 전용 멤버 함수* )
it_ 가 이전 위치를 가리키도록 감소시킵니다
( 설명 전용 멤버 함수* )
주어진 오프셋만큼 현재 위치를 전진시킵니다
( 설명 전용 멤버 함수* )
주어진 값만큼 현재 위치를 감소시킵니다
( 설명 전용 멤버 함수* )

비멤버 함수

기본 반복자를 비교함
(함수)
반복자 연산을 수행함
(함수)
(C++26)
기본 반복자를 역참조한 결과를 해당 rvalue 참조 타입으로 변환함
(함수)
(C++26)
두 기본 반복자가 가리키는 객체를 교환함
(함수)

예제

예비 버전은 Compiler Explorer 에서 확인할 수 있습니다.

#include <iostream>
#include <iterator>
#include <ranges>
int main()
{
    namespace views = std::views;
    static constexpr int p[]{1, 2, 3};
    static constexpr auto e = {4, 5};
    auto t = views::iota(6, 9);
    auto cat = views::concat(p, e, t);
    auto dog = views::concat(cat, cat);
    for (auto i{dog.begin()}; i != std::default_sentinel; ++i)
        std::cout << *i << ' ';
    std::cout << '\n';
}

출력:

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

참조문헌

  • C++26 표준 (ISO/IEC 14882:2026):
  • 26.7.18.3 클래스 템플릿 concat_view::iterator [range.concat.iterator]