| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
| Member functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
chunk_view::chunk_view | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(C++26) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
constexprexplicit chunk_view( V base,ranges::range_difference_t<V> n); | (since C++23) | |
Constructs achunk_view, initializing the underlying data members:
In addition, ifV models exactly theinput_range, the constructor initializes the following exposition-only data members:
remainder_ with0,current_.The behavior is undefined ifn is less than or equal to0.
| base | - | the adapted view |
| n | - | the chunk size |
#include <algorithm>#include <iostream>#include <ranges> int main(){auto i= std::views::iota(0,10);auto w= std::ranges::chunk_view(i,4); std::ranges::for_each(w,[](autoconst v){for(auto e: v)std::cout<< e<<' ';std::cout<<'\n';});}
Output:
0 1 2 34 5 6 78 9