LWG 3171: restore stream insertion for filesystem::directory_entry

* include/bits/fs_dir.h (operator<<): Overload for directory_entry,
	as per LWG 3171.
	* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.

From-SVN: r267238
This commit is contained in:
Jonathan Wakely 2018-12-18 16:57:36 +00:00 committed by Jonathan Wakely
parent fb601354e1
commit 4894e316a8
2 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2018-12-18 Jonathan Wakely <jwakely@redhat.com>
* include/bits/fs_dir.h (operator<<): Overload for directory_entry,
as per LWG 3171.
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.
* src/filesystem/std-dir.cc (filesystem::_Dir::advance): Move new
path instead of copying.

View File

@ -300,6 +300,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
friend class directory_iterator;
friend class recursive_directory_iterator;
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 3171. LWG 2989 breaks directory_entry stream insertion
template<typename _CharT, typename _Traits>
friend basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const directory_entry& __d)
{ return __os << __d.path(); }
directory_entry(const filesystem::path& __p, file_type __t)
: _M_path(__p), _M_type(__t)
{ }