delimiter{0};
        constexpr std::ranges::lazy_split_view outer_view{source, delimiter};
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "splits[" << std::[ranges::distance](http://en.cppreference.com/w/cpp/iterator/ranges/distance)(outer_view) << "]:  ";
        for (auto const& inner_view: outer_view)
            print(inner_view);
     
        constexpr [std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) hello{"Hello C++ 20 !"};
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "\n" "substrings: ";
        std::[ranges::for_each](http://en.cppreference.com/w/cpp/algorithm/ranges/for_each)(hello | std::views::lazy_split(' '), print);
     
        constexpr [std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) text{"Hello-+-C++-+-20-+-!"};
        constexpr [std::string_view](http://en.cppreference.com/w/cpp/string/basic_string_view) delim{"-+-"};
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "\n" "substrings: ";
        std::[ranges::for_each](http://en.cppreference.com/w/cpp/algorithm/ranges/for_each)(text | std::views::lazy_split(delim), print);
    }

Output:

    
    
    splits[5]:  { } { 1 } { 2 3 } { 4 5 6 } { 7 8 9 }
    substrings: { H e l l o } { C + + } { 2 0 } { ! }
    substrings: { H e l l o } { C + + } { 2 0 } { ! }

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/lazy_split_view&action=edit&section=7
"Edit section: Defect reports") ]  Defect reports

The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.

DR  |  Applied to  |  Behavior as published  |  Correct behavior   
---|---|---|---  
[ P2210R2 ](https://wg21.link/P2210R2) |  C++20  |  the old ` split_view ` was too lazy to be easily used  |  moves its functionality to ` lazy_split_view `  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/lazy_split_view&action=edit&section=8
"Edit section: See also") ]  See also

[ ranges::split_view  views::split  ](/w/cpp/ranges/split_view "cpp/ranges/split view") (C++20)  |  a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") over the subranges obtained from splitting another [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") using a delimiter   
(class template)  (range adaptor object)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/dsc_split_view&action=edit)  
---|---  
[ ranges::join_view  views::join  ](/w/cpp/ranges/join_view "cpp/ranges/join view") (C++20)  |  a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") consisting of the sequence obtained from flattening a [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view") of [ ` range ` s ](/w/cpp/ranges/range "cpp/ranges/range")   
(class template)  (range adaptor object)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/dsc_join_view&action=edit)  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/lazy_split_view&oldid=157810
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/lazy_split_view&oldid=157810)
"

#####  Navigation

  * [ Support us ](http://www.cppreference.com/support)
  * [ Recent changes ](/w/Special:RecentChanges "A list of recent changes in the wiki \[r\]")
  * [ FAQ ](/w/Cppreference:FAQ)
  * [ Offline version ](/w/Cppreference:Archives)

#####  Toolbox

  * [ What links here ](/w/Special:WhatLinksHere/cpp/ranges/lazy_split_view "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/lazy_split_view "Recent changes in pages linked from this page \[k\]")
  * [ Upload file ](http://upload.cppreference.com/w/Special:Upload "Upload files \[u\]")
  * [ Special pages ](/w/Special:SpecialPages "A list of all special pages \[q\]")
  * [ Printable version ](/mwiki/index.php?title=cpp/ranges/lazy_split_view&printable=yes "Printable version of this page \[p\]")
  * [ Permanent link ](/mwiki/index.php?title=cpp/ranges/lazy