638ad333ec
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 |
||
---|---|---|
.. | ||
config | ||
doc | ||
include | ||
libsupc++ | ||
po | ||
python | ||
scripts | ||
src | ||
testsuite | ||
acinclude.m4 | ||
aclocal.m4 | ||
ChangeLog | ||
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 | ||
configure | ||
configure.ac | ||
configure.host | ||
crossconfig.m4 | ||
fragment.am | ||
linkage.m4 | ||
Makefile.am | ||
Makefile.in | ||
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.