Skip to content

Commit 47a9982

Browse files
Construct safe_ptr from std::unique_ptr
1 parent 9409110 commit 47a9982

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

safe_ptr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ namespace sf {
8585
public:
8686
template<typename... Args>
8787
safe_ptr(Args... args) : ptr(std::make_shared<T>(args...)), mtx_ptr(std::make_shared<mutex_t>()) {}
88+
safe_ptr(std::unique_ptr<T>&& ptr) : ptr(std::move(ptr)), mtx_ptr(std::make_shared<mutex_t>()) {}
8889

8990
auto_lock_t<x_lock_t> operator -> () { return auto_lock_t<x_lock_t>(get_obj_ptr(), *get_mtx_ptr()); }
9091
auto_lock_obj_t<x_lock_t> operator * () { return auto_lock_obj_t<x_lock_t>(get_obj_ptr(), *get_mtx_ptr()); }

0 commit comments

Comments
 (0)