commit d92a25e1e4d8542c6135aed923d124a5fe00f9a3
parent 3850c60141a215bf6b494a921959fa1f1d691e41
Author: Johannes Lorenz <[email protected]>
Date: Sat, 19 Oct 2019 08:29:56 +0200
Implement unique_ptr assign move operator
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/globals.h b/src/globals.h
@@ -274,9 +274,13 @@ class m_unique_ptr
T* ptr = nullptr;
public:
m_unique_ptr() = default;
- m_unique_ptr(m_unique_ptr&& other) {
+ m_unique_ptr(m_unique_ptr&& other) : ptr(other.ptr) {
+ other.ptr = nullptr;
+ }
+ m_unique_ptr& operator=(m_unique_ptr&& other) {
ptr = other.ptr;
other.ptr = nullptr;
+ return *this;
}
m_unique_ptr(const m_unique_ptr& other) = delete;
~m_unique_ptr() { ptr = nullptr; }