1
0
Fork 0

Codefix: add move operators to SQObjectPtr

pull/13777/head
Rubidium 2025-03-12 21:19:05 +01:00 committed by rubidium42
parent 35ef197be4
commit 2b88f58384
1 changed files with 14 additions and 0 deletions

View File

@ -161,6 +161,14 @@ struct SQObjectPtr : public SQObject
_unVal=o._unVal;
__AddRef(_type,_unVal);
}
SQObjectPtr(SQObjectPtr &&o)
{
SQ_OBJECT_RAWINIT()
this->_type = OT_NULL;
this->_unVal.pUserPointer = nullptr;
std::swap(this->_type, o._type);
std::swap(this->_unVal, o._unVal);
}
SQObjectPtr(const SQObject &o)
{
SQ_OBJECT_RAWINIT()
@ -330,6 +338,12 @@ struct SQObjectPtr : public SQObject
__Release(tOldType,unOldVal);
return *this;
}
inline SQObjectPtr& operator=(SQObjectPtr &&obj)
{
std::swap(this->_type, obj._type);
std::swap(this->_unVal, obj._unVal);
return *this;
}
inline SQObjectPtr& operator=(const SQObject& obj)
{
SQObjectType tOldType;