face<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_cend&action=edit)  
[ operator bool  ](/w/cpp/ranges/view_interface/operator_bool "cpp/ranges/view interface/operator bool") (C++20)  |  returns whether the derived view is not empty. Provided if  [ ranges::empty ](/w/cpp/ranges/empty "cpp/ranges/empty") is applicable to it.   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_operator_bool&action=edit)  
[ front  ](/w/cpp/ranges/view_interface/front "cpp/ranges/view interface/front") (C++20)  |  returns the first element in the derived view. Provided if it satisfies [ ` forward_range ` ](/w/cpp/ranges/forward_range "cpp/ranges/forward range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_front&action=edit)  
[ back  ](/w/cpp/ranges/view_interface/back "cpp/ranges/view interface/back") (C++20)  |  returns the last element in the derived view. Provided if it satisfies [ ` bidirectional_range ` ](/w/cpp/ranges/bidirectional_range "cpp/ranges/bidirectional range") and [ ` common_range ` ](/w/cpp/ranges/common_range "cpp/ranges/common range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_back&action=edit)  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/chunk_by_view&action=edit&section=3 "Edit
section: Deduction guides") ]  [ Deduction guides
](/w/cpp/ranges/chunk_by_view/deduction_guides "cpp/ranges/chunk by
view/deduction guides")

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/chunk_by_view&action=edit&section=4 "Edit
section: Nested classes") ]  Nested classes

[ _ iterator  _ ](/w/cpp/ranges/chunk_by_view/iterator "cpp/ranges/chunk by view/iterator") (C++23)  |  the iterator type   
(  exposition-only member class template*  )  
---|---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/chunk_by_view&action=edit&section=5 "Edit
section: Notes") ]  Notes

In order to provide the amortized constant time complexity required by the [ `
range ` ](/w/cpp/ranges/range "cpp/ranges/range") concept, the result of [ `
begin() ` ](/w/cpp/ranges/chunk_by_view/begin "cpp/ranges/chunk by
view/begin") is cached within the ` chunk_by_view ` object. If the underlying
range is modified after the first call to [ ` begin() `
](/w/cpp/ranges/chunk_by_view/begin "cpp/ranges/chunk by view/begin") ,
subsequent uses of the ` chunk_by_view ` object might have unintuitive
behavior.

[ Feature-test ](/w/cpp/utility/feature_test "cpp/utility/feature test") macro  |  Value  |  Std  |  Feature   
---|---|---|---  
[ ` __cpp_lib_ranges_chunk_by ` ](/w/cpp/feature_test#cpp_lib_ranges_chunk_by "cpp/feature test") |  202202L  |  (C++23)  |  ` std::ranges::chunk_by_view `  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/chunk_by_view&action=edit&section=6 "Edit
section: Example") ]  Example

Run this code

    
    
    #include <functional>
    #include <iostream>
    #include <ranges>
    #include <string_view>
    #include <vector>
     
    void print_chunks(auto view, [std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) separator = ", ")
    {
        for (auto const subrange : view)
        {
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '[';
            for ([std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) prefix; auto const& elem : subrange)
                [std::cout](http://en.cppreference.com/w/cpp/io/cout) << prefix << elem, prefix = separator;
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "] ";
        }
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
    }
     
    int main()
    {