gcc/libstdc++-v3
Jonathan Wakely 638ad333ec Fix non-standard behaviour of std::istream_iterator
The current implementation of istream_iterator allows the iterator to be
reused after reaching end-of-stream, so that subsequent reads from the
stream can succeed (e.g. if the stream state has been cleared and stream
position changed from EOF). The P0738R2 paper clarified that the
expected behaviour is to set the stream pointer to null after reaching
end-of-stream, preventing further reads.

This implements that requirement, and adds the new default constructor
to std::ostream_iterator.

	* include/bits/stream_iterator.h (istream_iterator::_M_equal()): Make
	private.
	(istream_iterator::_M_read()): Do not check stream state before
	attempting extraction. Set stream pointer to null when extraction
	fails (P0738R2).
	(operator==(const istream_iterator&, const istream_iterator&)): Change
	to be a hidden friend of istream_iterator.
	(operator!=(const istream_iterator&, const istream_iterator&)):
	Likewise.
	(ostream_iterator::ostream_iterator()): Add default constructor.
	(ostream_iterator::ostream_iterator(ostream_type*, const C*)): Use
	addressof.
	* testsuite/24_iterators/istream_iterator/1.cc: New test.
	* testsuite/24_iterators/ostream_iterator/1.cc: New test.
	* testsuite/24_iterators/ostream_iterator/70766.cc: Also check
	constructor taking a string.
	* testsuite/24_iterators/ostream_iterator/requirements/constexpr.cc:
	New test.

From-SVN: r272491
2019-06-19 23:57:10 +01:00
..
config PR libstdc++/85494 use rdseed and rand_s in std::random_device 2019-05-29 15:45:35 +01:00
doc Corrections for C++2a library status table 2019-06-03 14:32:17 +01:00
include Fix non-standard behaviour of std::istream_iterator 2019-06-19 23:57:10 +01:00
libsupc++ PR libstdc++/90682 allow set_terminate(0) and set_unexpected(0) 2019-05-31 11:35:11 +01:00
po PR libstdc++/89466 avoid slow xsltproc command in configure 2019-02-27 11:25:44 +00:00
python Have std::vector printer's iterator return bool for vector<bool> 2019-06-19 23:57:06 +01:00
scripts Remove Profile Mode, deprecated since GCC 7.1 2019-05-13 11:50:21 +01:00
src PR libstdc++/90281 Fix string conversions for filesystem::path 2019-06-17 15:19:04 +01:00
testsuite Fix non-standard behaviour of std::istream_iterator 2019-06-19 23:57:10 +01:00
acinclude.m4 PR libstdc++/85494 use rdseed and rand_s in std::random_device 2019-05-29 15:45:35 +01:00
aclocal.m4
ChangeLog Fix non-standard behaviour of std::istream_iterator 2019-06-19 23:57:10 +01:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
config.h.in PR libstdc++/85494 use rdseed and rand_s in std::random_device 2019-05-29 15:45:35 +01:00
configure PR libstdc++/90770 fix missing src/debug/Makefile 2019-06-07 20:57:19 +01:00
configure.ac PR libstdc++/85494 use rdseed and rand_s in std::random_device 2019-05-29 15:45:35 +01:00
configure.host Remove obsolete Solaris 10 support 2019-05-14 17:17:23 +00:00
crossconfig.m4 PR libstdc++/89460 Fix Networking TS test failures on HP-UX 2019-03-11 16:28:11 +00:00
fragment.am
linkage.m4
Makefile.am
Makefile.in PR libstdc++/89466 avoid slow xsltproc command in configure 2019-02-27 11:25:44 +00:00
README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.