r++  
chunk_view:: _iterator_ ::operator++  (int)  
chunk_view:: _iterator_ ::operator--  
chunk_view:: _iterator_ ::operator--  (int)  
chunk_view:: _iterator_ ::operator+=  
chunk_view:: _iterator_ ::operator-=
](/w/cpp/ranges/chunk_view/iterator/operator_arith "cpp/ranges/chunk
view/iterator/operator arith")  
[ operator==  (chunk_view:: _iterator_ )  
operator< (chunk_view:: _iterator_ )  
operator> (chunk_view:: _iterator_ )  
operator<=  (chunk_view:: _iterator_ )  
operator>=  (chunk_view:: _iterator_ )  
operator<=> (chunk_view:: _iterator_ )
](/w/cpp/ranges/chunk_view/iterator/operator_cmp "cpp/ranges/chunk
view/iterator/operator cmp")  
[ operator+  (chunk_view:: _iterator_ )  
operator-  (chunk_view:: _iterator_ )
](/w/cpp/ranges/chunk_view/iterator/operator_arith2 "cpp/ranges/chunk
view/iterator/operator arith2")  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/chunk_view/navbar_content&action=edit)

Defined in header ` [ <ranges> ](/w/cpp/header/ranges "cpp/header/ranges") ` |  |   
---|---|---  
template  < [ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view)
V  >  
requires [ ranges::  input_range
](http://en.cppreference.com/w/cpp/ranges/input_range) < V  >  
class  chunk_view  
:  public  [ ranges::  view_interface  ](http://en.cppreference.com/w/cpp/ranges/view_interface) < chunk_view  < V  >> |  (1)  |  (since C++23)   
template  < [ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view)
V  >  
requires [ ranges::  forward_range
](http://en.cppreference.com/w/cpp/ranges/forward_range) < V  >  
class  chunk_view  < V  >  
:  public  [ ranges::  view_interface  ](http://en.cppreference.com/w/cpp/ranges/view_interface) < chunk_view  < V  >> |  (2)  |  (since C++23)   
namespace  views  {  
inline  constexpr  /* unspecified */  chunk  =  /* unspecified */  ;  
}  |  (3)  |  (since C++23)   
Call signature  |  |   
template  < [ ranges::  viewable_range
](http://en.cppreference.com/w/cpp/ranges/viewable_range) R  >  
constexpr  [ ranges::  view  ](http://en.cppreference.com/w/cpp/ranges/view) auto  chunk  (  R  && r, [ ranges::  range_difference_t  ](http://en.cppreference.com/w/cpp/ranges/iterator_t) < R  > n  )  ;  |  |  (since C++23)   
template  < class  DifferenceType  >  
constexpr  /*range adaptor closure*/  chunk  (  DifferenceType  && n  )  ;  |  |  (since C++23)   
Helper templates  |  |   
template  < class  I  >  
constexpr  I __div_ceil  (  I num, I denom  )  ;  |  (4)  |  (  exposition only*  )   
|  |   
  
` chunk_view ` takes a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") and
a number  n  and produces a range of views (the _chunks_ ) of the original
view, such that each _chunk_ , except maybe the last one, has the size ` n ` .
These _chunks_ are non-overlapping, successive sub-ranges of the elements of
the original view, in order.

Let ` _s_ ` be the size of the original view. If ` _s_ ` is not the multiple
of  n  , the size of the _last_ produced view is exactly  s  %  n  (the
remainder). Otherwise, the size of each _chunk_ , including the last one, is
n  .

The size of produced view is  __div_ceil  (  s  )  .

If the  n  is not greater than  ​  0  ​  the behavior is undefined.

1)  An implementation that supports the underlying view  V  that models only [
` input_range ` ](/w/cpp/ranges/input_range "cpp/ranges/input range") .

2)  A partial specialization that supports the underlying view  V  that models
[ ` forward_range ` ](/w/cpp/ranges/forward_range "cpp/ranges/forward range")
or stronger. Models [ ` common_range ` ](/w/cpp/ranges/common_range
"cpp/ranges/common range") if the underlying view  V  is [ ` forward_range `
](/w/cpp/ranges/forward_range "cpp/ranges/forward range") , [ ` common_range `
](/w/cpp/ranges/common_range "cpp/ranges/common range") , and either [ `
sized_range ` ](/w/cpp/ranges/sized_range "cpp/ranges/sized range") or non [ `
bidirectional_range ` ](/w/cpp/ranges/bi