summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/include/fx_memory.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/fxcrt/include/fx_memory.h b/core/fxcrt/include/fx_memory.h
index fa8da6067c..53e6b9d1eb 100644
--- a/core/fxcrt/include/fx_memory.h
+++ b/core/fxcrt/include/fx_memory.h
@@ -23,6 +23,7 @@ void FXMEM_DefaultFree(void* pointer, int flags);
#include <stdlib.h>
#include <limits>
+#include <memory>
#include <new>
NEVER_INLINE void FX_OutOfMemoryTerminate();
@@ -100,6 +101,12 @@ struct ReleaseDeleter {
inline void operator()(T* ptr) const { ptr->Release(); }
};
+// Used to help transfer ownership of a raw pointer to std::unique_ptr.
+template <typename T>
+std::unique_ptr<T> WrapUnique(T* ptr) {
+ return std::unique_ptr<T>(ptr);
+}
+
class CFX_Deletable {
public:
virtual ~CFX_Deletable() {}