From: Jonathan Wakely Date: Tue, 10 May 2016 13:09:22 +0000 (+0100) Subject: Optimize __directory_iterator_proxy for the common case X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77a87b2a0e5fb069107479d1e2bd3efafd6bd3ab;p=gcc.git Optimize __directory_iterator_proxy for the common case * include/experimental/bits/fs_dir.h (__directory_iterator_proxy): Overload operator* to move from rvalues. From-SVN: r236078 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 20c55ff4d5e..7aaeefaa518 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2016-05-10 Jonathan Wakely + * include/experimental/bits/fs_dir.h (__directory_iterator_proxy): + Overload operator* to move from rvalues. + PR libstdc++/71036 * src/filesystem/ops.cc (create_dir): Handle EEXIST from mkdir. * testsuite/experimental/filesystem/operations/create_directory.cc: diff --git a/libstdc++-v3/include/experimental/bits/fs_dir.h b/libstdc++-v3/include/experimental/bits/fs_dir.h index 5fd41c2127f..011d3981622 100644 --- a/libstdc++-v3/include/experimental/bits/fs_dir.h +++ b/libstdc++-v3/include/experimental/bits/fs_dir.h @@ -158,7 +158,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 struct __directory_iterator_proxy { - const directory_entry& operator*() const noexcept { return _M_entry; } + const directory_entry& operator*() const& noexcept { return _M_entry; } + + directory_entry operator*() && noexcept { return std::move(_M_entry); } private: friend class directory_iterator;