Stand/Stand/fwRegdRef.hpp

31 lines
380 B
C++
Raw Permalink Normal View History

2024-10-16 11:20:42 +08:00
#pragma once
namespace rage
{
template <typename T>
struct fwRegdRef
{
T* m_p;
operator T* () const noexcept
{
return m_p;
}
T* operator ->() const noexcept
{
return m_p;
}
// Set this ref to nullptr.
void reset()
{
if (m_p != nullptr)
{
static_cast<fwRefAwareBase*>(m_p)->RemoveKnownRef((void**)&m_p);
m_p = nullptr;
}
}
};
}