[Scummvm-git-logs] scummvm master -> 5e3d0029b3aca8837428a44c579132d3ba160600

lephilousophe noreply at scummvm.org
Sun May 8 09:08:23 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5e3d0029b3 COMMON: Implement move constructor of ScopedPtr


Commit: 5e3d0029b3aca8837428a44c579132d3ba160600
    https://github.com/scummvm/scummvm/commit/5e3d0029b3aca8837428a44c579132d3ba160600
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2022-05-08T11:07:40+02:00

Commit Message:
COMMON: Implement move constructor of ScopedPtr

This helps when passing ScopedPtr as function arguments

Changed paths:
    common/ptr.h


diff --git a/common/ptr.h b/common/ptr.h
index 4d2590d1516..20b2dc234c5 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -562,6 +562,14 @@ public:
 	explicit ScopedPtr(PointerType o = nullptr) : _pointer(o) {}
 	ScopedPtr(std::nullptr_t) : _pointer(nullptr) {}
 
+	/**
+	 * Move constructor
+	 */
+	template<class T2>
+	ScopedPtr(ScopedPtr<T2> &&o) : _pointer(o._pointer) {
+		o._pointer = nullptr;
+        }
+
 	ReferenceType operator*() const { return *_pointer; }
 	PointerType operator->() const { return _pointer; }
 




More information about the Scummvm-git-logs mailing list