From 807e44900c80a71ae5794db327be8deeb84f1a87 Mon Sep 17 00:00:00 2001 From: Drunk Russian Gun Date: Sun, 19 Jun 2022 09:24:06 +0300 Subject: [PATCH] Construct safe_ptr from std::unique_ptr --- safe_ptr.h | 1 + 1 file changed, 1 insertion(+) diff --git a/safe_ptr.h b/safe_ptr.h index c0c30f9..ee123b6 100644 --- a/safe_ptr.h +++ b/safe_ptr.h @@ -85,6 +85,7 @@ namespace sf { public: template safe_ptr(Args... args) : ptr(std::make_shared(args...)), mtx_ptr(std::make_shared()) {} + explicit safe_ptr(std::unique_ptr&& ptr) : ptr(std::move(ptr)), mtx_ptr(std::make_shared()) {} auto_lock_t operator -> () { return auto_lock_t(get_obj_ptr(), *get_mtx_ptr()); } auto_lock_obj_t operator * () { return auto_lock_obj_t(get_obj_ptr(), *get_mtx_ptr()); }