Namespaces
Variants

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

cppreference.net에서
 
 
범위 라이브러리
범위 어댑터
 
 
template< bool Const >
class /*iterator*/
(1) (설명 전용*)
도우미 개념
template< bool Const, class... Rs >
concept /*concat-is-random-access*/ = /* see description */;
(2) (설명 전용*)
template< bool Const, class... Rs >
concept /*concat-is-bidirectional*/ = /* see description */;
(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 = // exposition only
    all-random-access <Const, Rs...> &&
    (ranges::common_range<maybe-const <Const, Fs>> && ...);

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

template<bool Const, class... Rs>
concept concat-is-bidirectional = // exposition only
    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]