mirror of
https://github.com/Jous99/F4MP.git
synced 2026-01-13 00:40:53 +01:00
36 lines
639 B
C++
36 lines
639 B
C++
#pragma once
|
|
|
|
template <class T> struct NiPointer
|
|
{
|
|
NiPointer<T>& operator=(const NiPointer& acRhs)
|
|
{
|
|
if (object != acRhs.object)
|
|
{
|
|
if (acRhs.object)
|
|
acRhs.object->IncRef();
|
|
if (object)
|
|
object->DecRef();
|
|
|
|
object = acRhs.object;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
NiPointer<T>& operator=(T* aRhs)
|
|
{
|
|
if (object != aRhs)
|
|
{
|
|
if (aRhs)
|
|
aRhs->IncRef();
|
|
if (object)
|
|
object->DecRef();
|
|
|
|
object = aRhs;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
T* object;
|
|
};
|