From f83c4a8582f8a5c09b84f9af21779fafc0a8c3f4 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Thu, 19 Mar 2020 14:21:10 -0700 Subject: [PATCH] libobs: Add move assignment operator for BPtr --- libobs/util/util.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libobs/util/util.hpp b/libobs/util/util.hpp index 572ec088c..db4718646 100644 --- a/libobs/util/util.hpp +++ b/libobs/util/util.hpp @@ -20,6 +20,7 @@ #include #include +#include #include "bmem.h" #include "config-file.h" @@ -36,7 +37,7 @@ template class BPtr { public: inline BPtr(T *p = nullptr) : ptr(p) {} - inline BPtr(BPtr &&other) : ptr(other.ptr) { other.ptr = nullptr; } + inline BPtr(BPtr &&other) { *this = std::move(other); } inline ~BPtr() { bfree(ptr); } inline T *operator=(T *p) @@ -45,6 +46,14 @@ public: ptr = p; return p; } + + inline BPtr &operator=(BPtr &&other) + { + ptr = other.ptr; + other.ptr = nullptr; + return *this; + } + inline operator T *() { return ptr; } inline T **operator&() {