* [PATCH] Simplify std::scoped_lock destructor
@ 2019-06-12 14:54 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2019-06-12 14:54 UTC (permalink / raw)
To: libstdc++, gcc-patches; +Cc: Lars Gullik Bjønnes
[-- Attachment #1: Type: text/plain, Size: 176 bytes --]
* include/std/mutex (scoped_lock::~scoped_lock()): Use fold
expression.
Thanks to Lars for pointing out this could be simplified.
Tested x86_64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1031 bytes --]
commit 7445abf1ee5e14e644efd0533fff9e0c125b1d2c
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Jun 12 14:52:06 2019 +0000
Simplify std::scoped_lock destructor
* include/std/mutex (scoped_lock::~scoped_lock()): Use fold
expression.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272187 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index ca2c669db9a..981b6725f7c 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-12 14:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 14:54 [PATCH] Simplify std::scoped_lock destructor Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).