Simplify std::scoped_lock destructor
authorJonathan Wakely <jwakely@redhat.com>
Wed, 12 Jun 2019 14:52:06 +0000 (15:52 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 12 Jun 2019 14:52:06 +0000 (15:52 +0100)
* include/std/mutex (scoped_lock::~scoped_lock()): Use fold
expression.

From-SVN: r272187

libstdc++-v3/ChangeLog
libstdc++-v3/include/std/mutex

index 6d5e4b9ec163b2f5d9b832bcbb111a1518c8fb64..008a709ce2d983e654872e7e9ec8702ae3ee9fd7 100644 (file)
@@ -1,5 +1,8 @@
 2019-06-12  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/std/mutex (scoped_lock::~scoped_lock()): Use fold
+       expression.
+
        * include/Makefile.am: Add new <bits/charconv.h> header.
        * include/Makefile.in: Regenerate.
        * include/bits/basic_string.h (to_string(int), to_string(unsigned))
index ca2c669db9aed72ad1e564d4174d096b729870bf..981b6725f7c93e7e3a931d116fd3a70345029110 100644 (file)
@@ -576,11 +576,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { } // calling thread owns mutex
 
       ~scoped_lock()
-      {
-       std::apply([](_MutexTypes&... __m) {
-         char __i[] __attribute__((__unused__)) = { (__m.unlock(), 0)... };
-       }, _M_devices);
-      }
+      { std::apply([](auto&... __m) { (__m.unlock(), ...); }, _M_devices); }
 
       scoped_lock(const scoped_lock&) = delete;
       scoped_lock& operator=(const scoped_lock&) = delete;