From eb84eb0588f44c7479d46c512f2f95385f404069 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 26 Mar 2020 21:55:00 +0100 Subject: [PATCH] Macro support for unpacking weak pointers. --- src/Assert.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Assert.hpp b/src/Assert.hpp index 2d8a3fe..6ef9c95 100644 --- a/src/Assert.hpp +++ b/src/Assert.hpp @@ -17,4 +17,7 @@ #define Assert(expr) ; #endif -#define AssertNotNull(value) Assert(value != nullptr) \ No newline at end of file +#define AssertNotNull(value) Assert(value != nullptr) +#define UnpackWeakPtr(weakPtr, sharedPtr) \ + Assert(!weakPtr.expired()); \ + auto sharedPtr = weakPtr.lock(); \ No newline at end of file