Namespaces
Variants

std::ranges::chunk_view<V>::size

cppreference.net에서
 
 
Ranges 라이브러리
Range 어댑터
 
std::ranges::chunk_view
멤버 함수
input_range을 위한 클래스
추론 가이드
outer-iterator
outer-iterator::value_type
inner-iterator
 
constexpr auto size() requires ranges::sized_range<V>;
(1) (C++23부터)
constexpr auto size() const requires ranges::sized_range<const V>;
(2) (C++23부터)

기반이 되는 뷰 base_의 크기를 기반 데이터 멤버 n_로 나눈 몫보다 작지 않은 가장 작은 정수 값인 요소의 개수를 반환합니다. (기본 생성된 경우 0) 이 멤버는 생성자에 전달된 수를 보유합니다. 다음 과 동일합니다: return to-unsigned-like(div-ceil(ranges::distance(base_), n_)); .

반환값

요소의 개수.

예제

#include <ranges>
int main()
{
    constexpr static auto v = {1, 2, 3, 4, 5};
    constexpr auto w{ std::ranges::chunk_view(v, 2) };
    static_assert(w.size() == (5 / 2 + (5 % 2 ? 1 : 0)));
}

참고 항목

범위의 크기와 동일한 정수를 반환합니다
(customization point object)
범위의 크기와 동일한 부호 있는 정수를 반환합니다
(customization point object)