commit 2025-08-25 23:34 edit a bit ZtCObjectNew in ZCppMain/ZMainHead.H

This commit is contained in:
2025-08-25 23:35:02 +09:00
parent 1e90010716
commit 71ec922958

View File

@ -2931,13 +2931,13 @@ namespace ZNsMain
template<typename TType> class ZtCObjectPtr */ template<typename TType> class ZtCObjectPtr */
/*///////////////////////////////////////////////////////// /*///////////////////////////////////////////////////////////
■ object 를 heap 에 생성하고, 참조 카운트를 이용하여 관리. ■ object 를 heap 에 생성하고, 참조 카운트를 이용하여 관리.
-- 2014-07-20 04:49:00 -- 2014-07-20 04:49:00
/////////////////////////////////////////////////////////*/ ///////////////////////////////////////////////////////////*/
template< typename TType, typename TAllocClass=ZCAllocClass template< typename TType, typename TAllocClass=ZCAllocClass
> >
@ -3002,20 +3002,28 @@ namespace ZNsMain
~ZtCObjectNew() ~ZtCObjectNew()
{ {
if(--mp_StTypeRefCnt->MI_RefCount<=0) this->ZCAllocator::DeleteMem(mp_StTypeRefCnt); if(--mp_StTypeRefCnt->MI_RefCount <= 0)
this->ZCAllocator::DeleteMem(mp_StTypeRefCnt);
}/* }/*
~ZtCObjectNew()*/ ~ZtCObjectNew()*/
ZtCObjectNew& operator=(const ZtCObjectNew& rhs) ZtCObjectNew& operator=(const ZtCObjectNew& rhs)
{ {
if(this==&rhs || mp_StTypeRefCnt==rhs.mp_StTypeRefCnt) return *this; if(this==&rhs || mp_StTypeRefCnt==rhs.mp_StTypeRefCnt)
{ return *this; }
/*++++++++++++++++++++++++++++++++++++++++++++++++++*/
#if(0) #if(0)
mp_StTypeRefCnt->MO_TypeData = rhs.mp_StTypeRefCnt->MO_TypeData; return *this; mp_StTypeRefCnt->MO_TypeData =
rhs.mp_StTypeRefCnt->MO_TypeData; return *this;
#else #else
if(--mp_StTypeRefCnt->MI_RefCount<=0) this->ZCAllocator::DeleteMem(mp_StTypeRefCnt); if(--mp_StTypeRefCnt->MI_RefCount <= 0)
this->ZCAllocator::DeleteMem( mp_StTypeRefCnt );
mp_StTypeRefCnt = rhs.mp_StTypeRefCnt; ++mp_StTypeRefCnt->MI_RefCount; return *this; mp_StTypeRefCnt = rhs.mp_StTypeRefCnt ;
++mp_StTypeRefCnt->MI_RefCount ;
return *this; /////////////////////////
#endif #endif
}/* }/*
ZtCObjectNew& operator=(const ZtCObjectNew& rhs)*/ ZtCObjectNew& operator=(const ZtCObjectNew& rhs)*/