[+] MemoryView::Clone()
[+] MemoryView::CloneSelf()
This commit is contained in:
parent
7fdcdb7568
commit
9805a57647
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user