| (1) | (since C++11, only if T is literal type) | ||
| (2) | |||
| (3) |
1) Constructs the end-of-stream iterator.
2) Initializes the iterator and stores the address of
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) 3) Constructs a copy of
other
. If T
is a literal type, this copy constructor is a trivial copy constructor.Parameters
stream | - | stream to initialize the istream_iterator with |
other | - | another istream_iterator of the same type |
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 | #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 | 1 2 3 4 5 |
Please login to continue.