From 5e3d0029b3aca8837428a44c579132d3ba160600 Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sun, 8 May 2022 11:07:40 +0200 Subject: [PATCH] COMMON: Implement move constructor of ScopedPtr This helps when passing ScopedPtr as function arguments --- common/ptr.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/ptr.h b/common/ptr.h index 4d2590d1516b..20b2dc234c55 100644 --- a/common/ptr.h +++ b/common/ptr.h @@ -562,6 +562,14 @@ class ScopedPtr : private NonCopyable, public SafeBool > { explicit ScopedPtr(PointerType o = nullptr) : _pointer(o) {} ScopedPtr(std::nullptr_t) : _pointer(nullptr) {} + /** + * Move constructor + */ + template + ScopedPtr(ScopedPtr &&o) : _pointer(o._pointer) { + o._pointer = nullptr; + } + ReferenceType operator*() const { return *_pointer; } PointerType operator->() const { return _pointer; }