Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::istrea...eam_iterator(3) C++ Standard Libarystd::istrea...eam_iterator(3)

NAME
       std::istream_iterator::istream_iterator	    -	   std::istream_itera-
       tor::istream_iterator

Synopsis
	  istream_iterator();						(until
       C++11)
	  constexpr    istream_iterator();				(since
       C++11)
	  constexpr  istream_iterator(				  (2)	(since
       C++20)
	  std::default_sentinel_t );
	  istream_iterator( istream_type& stream );	   (1) (3)
	  istream_iterator(	   const	istream_iterator&	 other
       (until C++11)
	  );						       (4)
	  istream_iterator(	   const	istream_iterator&	 other
       (since C++11)
	  ) = default;

	  1-2) Constructs the end-of-stream iterator
	  ,  value-initializes the stored value. This constructor is constexpr
       if the
	  initializer in the definition	auto x = T(); is a  constant  initial-
       izer
	  (since C++11).
	  3)  Initializes the iterator,	stores the address of stream in	a data
       member, and
	  performs the first read from the  input  stream  to  initialize  the
       cached value data
	  member.
	  4) Constructs	a copy of other.
	  If std::is_trivially_copy_constructible<T>::value is true, this copy
       constructor is
	  a trivial copy constructor.
	  (since C++11)

Parameters
	  stream - stream to initialize	the istream_iterator with
	  other	 - another istream_iterator of the same	type

Examples
       // Run this code

	#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

	 Defect	reports

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

	    DR	   Applied  to	       Behavior	as published		  Cor-
       rect behavior
	  P0738R2 C++98	     the first read may	be deferred to the  the	 first
       read is performed
			     first dereferencing		   in the con-
       structor

http://cppreference.com		  2022.07.31	 std::istrea...eam_iterator(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::istream_iterator::istream_iterator&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help