constexpr istream_iterator(); | (1) | |
istream_iterator( istream_type& stream ); | (2) | |
istream_iterator( const istream_iterator& other ) = default; | (3) |
std::is_trivially_default_constructible_v<T>
is true
.stream
in a data member. Optionally, performs the first read from the input stream to initialize the cached value data member (although it may be delayed until the first access)other
. If std::is_trivially_copy_constructible_v<T>
is true
, this copy constructor is a trivial copy constructor.stream | - | stream to initialize the istream_iterator with |
other | - | another istream_iterator of the same type |
#include <iostream> #include <iterator> #include <algorithm> #include <sstream> int main() { std::istringstream stream("1 2 3 4 5"); std::copy( std::istream_iterator<int>(stream), std::istream_iterator<int>(), std::ostream_iterator<int>(std::cout, " ") ); }
Output:
1 2 3 4 5
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/iterator/istream_iterator/istream_iterator