diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-08 23:20:56 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-08 23:20:56 +0200 |
commit | 90940a774eab876c38d5cef981b4be5bae67a462 (patch) | |
tree | 2e60edc1719ffd53752a55a7f0444166965e90c5 /compat/copyable-mutex.cpp | |
parent | e3292e1ddaa8d69eb320d2700fc582b4675cf8ce (diff) |
modernize only
Diffstat (limited to 'compat/copyable-mutex.cpp')
-rw-r--r-- | compat/copyable-mutex.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compat/copyable-mutex.cpp b/compat/copyable-mutex.cpp index 7c112c5e..dde84c83 100644 --- a/compat/copyable-mutex.cpp +++ b/compat/copyable-mutex.cpp @@ -2,10 +2,7 @@ mutex& mutex::operator=(const mutex& datum) { - inner = nullptr; - inner = std::make_unique<QMutex>(datum->isRecursive() - ? QMutex::Recursive - : QMutex::NonRecursive); + inner.emplace(datum->isRecursive() ? QMutex::Recursive : QMutex::NonRecursive); return *this; } @@ -15,7 +12,7 @@ mutex::mutex(const mutex& datum) } mutex::mutex(mutex::mode m) : - inner(std::make_unique<QMutex>(static_cast<QMutex::RecursionMode>(int(m)))) + inner { std::in_place, static_cast<QMutex::RecursionMode>(int(m)) } { } @@ -31,6 +28,6 @@ QMutex* mutex::operator->() const mutex::operator QMutex*() const { - return const_cast<QMutex*>(inner.get()); + return const_cast<QMutex*>(&inner.value()); } |