Optimize __directory_iterator_proxy for the common case
authorJonathan Wakely <jwakely@redhat.com>
Tue, 10 May 2016 13:09:22 +0000 (14:09 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 10 May 2016 13:09:22 +0000 (14:09 +0100)
* include/experimental/bits/fs_dir.h (__directory_iterator_proxy):
Overload operator* to move from rvalues.

From-SVN: r236078

libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/bits/fs_dir.h

index 20c55ff4d5e013e45d66af95ff5433da25101da5..7aaeefaa5180da43d5caed32abb1f2749f29bc39 100644 (file)
@@ -1,5 +1,8 @@
 2016-05-10  Jonathan Wakely  <jwakely@redhat.com>
 
+       * 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:
index 5fd41c2127fdaa2acdd353898d6ea7cd55a6ec98..011d3981622411eb4373c144b2b9f680f46843c4 100644 (file)
@@ -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;