diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-06-30 12:43:08 +0200 |
commit | a98326eb2954ac1e79f5eac28dbeab3ec15e047f (patch) | |
tree | bb16257a1894b488e365851273735ec13a9442ef /zen/globals.h | |
parent | 10.0 (diff) | |
download | FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.gz FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.tar.bz2 FreeFileSync-a98326eb2954ac1e79f5eac28dbeab3ec15e047f.zip |
10.1
Diffstat (limited to 'zen/globals.h')
-rwxr-xr-x | zen/globals.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/zen/globals.h b/zen/globals.h index 2066c380..10975414 100755 --- a/zen/globals.h +++ b/zen/globals.h @@ -21,10 +21,12 @@ class Global public: Global() { - static_assert(std::is_trivially_destructible<Pod>::value, "this memory needs to live forever"); + static_assert(std::is_trivially_destructible_v<Pod>, "this memory needs to live forever"); assert(!pod_.inst && !pod_.spinLock); //we depend on static zero-initialization! } + explicit Global(std::unique_ptr<T>&& newInst) { set(std::move(newInst)); } + ~Global() { set(nullptr); } std::shared_ptr<T> get() //=> return std::shared_ptr to let instance life time be handled by caller (MT usage!) @@ -60,7 +62,6 @@ private: //serialize access; can't use std::mutex: has non-trival destructor } pod_; }; - } #endif //GLOBALS_H_8013740213748021573485 |