[+] MemoryView::Clone()

[+] MemoryView::CloneSelf()
This commit is contained in:
Reece Wilson 2024-06-11 07:25:48 +01:00
parent 7fdcdb7568
commit 9805a57647

View File

@ -369,6 +369,30 @@ namespace Aurora::Memory
}
}
MemoryView Clone() const
{
auto uLength = this->uLength;
auto pData = AuMakeSharedArray<AuUInt8>(uLength);
if (!pData)
{
return {};
}
AuMemcpy(pData.get(), this->pBase, uLength);
return MemoryView(MemoryView(pData.get(), uLength), pData);
}
bool CloneSelf()
{
auto replacement = Clone();
if (!replacement)
{
return false;
}
AuResetMember(*this, replacement);
return true;
}
union
{
Void_t /*const*/ ptr;