ranges_iota_view

ranges_iota_view (증분 뷰)

std::ranges::iota_view은 시작 값에서 끝 바인드까지 반복적으로 증가시키며 요소를 생성하는 뷰예요. C++20부터 사용할 수 있어요.

출처: cppreference

본문

<ranges> 헤더에 정의되어 있고, 시그니처는 다음과 같아요.

template< std::weakly_incrementable W,
          std::semiregular Bound = std::unreachable_sentinel_t >
    requires /*weakly-equality-comparable-with*/<W, Bound> && std::copyable<W>
class iota_view
    : public ranges::view_interface<iota_view<W, Bound>>

(1) (since C++20)

namespace views {
    inline constexpr /* unspecified */ iota = /* unspecified */;
}

(2)

    1. 시작 값에서 끝 바인드까지 반복적으로 증가시키며 요소를 생성하는 뷰. Bound가 std::unreachable_sentinel_t면(즉 두 번째 인자를 주지 않으면) 무한 뷰예요.
    1. iota 뷰를 생성하는 뷰 팩토리 객체.

멤버 함수 (Member functions)

  • (constructor) — iota 뷰 생성 (시작과 끝 값 지정)
  • begin — 시작 요소 반복자 반환
  • end — 끝 바인드 센티널 반환
  • size — 요소 수 반환 (경계가 있을 때)

참고 (Notes)

views::iota(start), views::iota(start, end)로 생성해요. 무한 시퀀스를 만들 수도 있어요. C++ 표준의 std::iota (범위 채우기)와 이름은 같지만, 이건 지연 생성 뷰예요.

더 알아보기 (Learn more)

cppreference