[+] MemoryView::DemoteFromSharedView

This commit is contained in:
Reece Wilson 2024-05-21 11:30:15 +01:00
parent 30b89f1bd7
commit 60771f6e6b

View File

@ -424,7 +424,7 @@ namespace Aurora::Memory
} }
bool TryDemoteFromSharedView(const AuSPtr<MemoryView> &pCopy) bool TryDemoteFromSharedView(const AuSPtr<MemoryView> &pCopy)
{ {
if (pCopy && pCopy->HasControlBlock()) if (pCopy && pCopy->HasControlBlock())
{ {
AuResetMember(*this, AuConstReference(*pCopy.get())); AuResetMember(*this, AuConstReference(*pCopy.get()));
@ -435,6 +435,24 @@ namespace Aurora::Memory
return false; return false;
} }
} }
void DemoteFromSharedView(const AuSPtr<MemoryView> &pCopy)
{
if (!pCopy)
{
AuResetMember(*this);
return;
}
if (pCopy->HasControlBlock())
{
AuResetMember(*this, AuConstReference(*pCopy.get()));
}
else
{
AuResetMember(*this, AuConstReference(*pCopy.get()), pCopy);
}
}
}; };
using MemoryViewRead = MemoryView<true>; using MemoryViewRead = MemoryView<true>;