[+] AuHeapUniqueDeleterClass
This commit is contained in:
parent
21f35e0bea
commit
c3a1ae1576
26
Include/auROXTL/MemoryModel/AuHeapUniqueDeleterClass.hpp
Executable file
26
Include/auROXTL/MemoryModel/AuHeapUniqueDeleterClass.hpp
Executable file
@ -0,0 +1,26 @@
|
||||
/***
|
||||
Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: AuHeapUniqueDeleterClass.hpp
|
||||
Date: 2024-09-22
|
||||
Author: Reece
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template <typename Type, typename Expects = Type>
|
||||
struct AuHeapUniqueDeleterClass : AuHeapAccessor2
|
||||
{
|
||||
inline static auto Get()
|
||||
{
|
||||
return AuHeapAccessor2::Get<Type>();
|
||||
}
|
||||
|
||||
inline void operator()(Expects *pThat) const
|
||||
{
|
||||
if (!pThat)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Get()((Type *)pThat);
|
||||
}
|
||||
};
|
@ -141,6 +141,7 @@ public:
|
||||
|
||||
protected:
|
||||
friend struct AuHeapAccessor;
|
||||
friend struct AuHeapAccessor2;
|
||||
friend struct Aurora::Memory::ProxyHeap;
|
||||
|
||||
virtual AuSPtr<AuHeap> GetSelfReference() = 0; // may return empty/default. not all heaps are sharable.
|
||||
|
@ -21,3 +21,13 @@ struct AuHeapAccessor
|
||||
return pHeap->GetSelfReferenceRaw();
|
||||
}
|
||||
};
|
||||
|
||||
struct AuHeapAccessor2
|
||||
{
|
||||
protected:
|
||||
template <typename Type>
|
||||
inline static auto Get()
|
||||
{
|
||||
return &AuHeap::DeleteThat<Type>;
|
||||
}
|
||||
};
|
@ -459,6 +459,7 @@ inline constexpr bool operator!=(const Aurora::Memory::BaseAuroraRuntimeAllocato
|
||||
#include <auROXTL/MemoryModel/auHeapStats.hpp>
|
||||
#include <auROXTL/MemoryModel/auHeap.hpp>
|
||||
#include <auROXTL/MemoryModel/auHeapAccessor.hpp>
|
||||
#include <auROXTL/MemoryModel/AuHeapUniqueDeleterClass.hpp>
|
||||
|
||||
#include <auROXTL/MemoryModel/auDummyHeap.hpp>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user