[Scummvm-git-logs] scummvm master -> 509504d16f247954077e327d07b2afb37a26727c

dreammaster noreply at scummvm.org
Sun May 8 03:16:38 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:
509504d16f COMMON: Support nullptr assignments to ScopedPtr


Commit: 509504d16f247954077e327d07b2afb37a26727c
    https://github.com/scummvm/scummvm/commit/509504d16f247954077e327d07b2afb37a26727c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-07T20:16:31-07:00

Commit Message:
COMMON: Support nullptr assignments to ScopedPtr

Changed paths:
    common/ptr.h


diff --git a/common/ptr.h b/common/ptr.h
index 0c509a74f2e..77f694db29a 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -560,6 +560,7 @@ public:
 	typedef T &ReferenceType;
 
 	explicit ScopedPtr(PointerType o = nullptr) : _pointer(o) {}
+	ScopedPtr(nullptr_t) : _pointer(nullptr) {}
 
 	ReferenceType operator*() const { return *_pointer; }
 	PointerType operator->() const { return _pointer; }
@@ -582,6 +583,13 @@ public:
 		_pointer = o;
 	}
 
+	/**
+	 * Affectation with nullptr
+	 */
+	ScopedPtr &operator=(nullptr_t) {
+		reset(nullptr);
+	}
+
 	/**
 	 * Replaces the ScopedPtr with another scoped ScopedPtr.
 	 */




More information about the Scummvm-git-logs mailing list