_view/iterator "cpp/ranges/basic istream view/iterator") (C++20)  |  the iterator type of  ` basic_istream_view `   
(  exposition-only member class*  )  
---|---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/basic_istream_view&action=edit&section=3
"Edit section: Example") ]  Example

Run this code

    
    
    #include <algorithm>
    #include <iomanip>
    #include <iostream>
    #include <iterator>
    #include <ranges>
    #include <sstream>
    #include <string>
     
    int main()
    {
        auto words = [std::istringstream](http://en.cppreference.com/w/cpp/io/basic_istringstream){"today is yesterday’s tomorrow"};
        for (const auto& s : std::views::istream<[std::string](http://en.cppreference.com/w/cpp/string/basic_string)>(words))
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << [std::quoted](http://en.cppreference.com/w/cpp/io/manip/quoted)(s, '/') << ' ';
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
     
        auto floats = [std::istringstream](http://en.cppreference.com/w/cpp/io/basic_istringstream){"1.1  2.2\t3.3\v4.4\f55\n66\r7.7  8.8"};
        std::[ranges::copy](http://en.cppreference.com/w/cpp/ranges-algorithm-placeholder/copy)(
            std::views::istream<float>(floats),
            [std::ostream_iterator](http://en.cppreference.com/w/cpp/iterator/ostream_iterator)<float>{[std::cout](http://en.cppreference.com/w/cpp/io/cout), ", "}
        );
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '\n';
    }

Output:

    
    
    /today/ /is/ /yesterday’s/ /tomorrow/
    1.1, 2.2, 3.3, 4.4, 55, 66, 7.7, 8.8,

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/basic_istream_view&action=edit&section=4
"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   
---|---|---|---  
[ P2325R3 ](https://wg21.link/P2325R3) |  C++20  |  default constructor was provided as [ ` view ` ](/w/cpp/ranges/view "cpp/ranges/view")   
must be [ ` default_initializable ` ](/w/cpp/concepts/default_initializable "cpp/concepts/default initializable") |  removed along with the requirement   
[ LWG 3568 ](https://cplusplus.github.io/LWG/issue3568) |  C++20  |  P2325R3 accidentally made the stored value default-initialized  |  restored to value-initialization   
[ P2432R1 ](https://wg21.link/P2432R1) |  C++20  |  ` ranges::istream_view ` was a function template and   
did not follow the naming convention  |  made an alias template;   
customization point objects added  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/basic_istream_view&action=edit&section=5
"Edit section: See also") ]  See also

[ istream_iterator  ](/w/cpp/iterator/istream_iterator "cpp/iterator/istream iterator") |  input iterator that reads from  [ std::basic_istream ](/w/cpp/io/basic_istream "cpp/io/basic istream")   
(class template)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/iterator/dsc_istream_iterator&action=edit)  
---|---  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/basic_istream_view&oldid=167023
](https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/basic_istream_view&oldid=167023)
"

#####  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/basic_istream_view "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/ranges/basic_istream_view "Recent changes in pages linked from this page \[k\]")
  * [ Upload file ](http://upload.cppreference.com/w/Special:Upload "Upload files \[u\]")
  * [ Special pages