From c1d788a611dac122d87cbe6bf515f8a7778ab8ec Mon Sep 17 00:00:00 2001 From: sauron Date: Sun, 5 Oct 2025 21:55:32 +0900 Subject: [PATCH] commit 2025-10-05 21:55 edit a bit ZtCObjNew : ZCppMain/ZMainHead.H --- ZCppMain/ZMainHead.H | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index 7722f7a..ca1e905 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -4606,10 +4606,28 @@ namespace ZNsMain { return *this; } /*++++++++++++++++++++++++++++++++++++++++++++++++++*/ + #if(_CODE_OLD_) mp_StTypeRefCnt->MO_TypeData = rhs.mp_StTypeRefCnt->MO_TypeData ; + #else + /*////////////////////////////////////////////// - return *this; //////////////////// + ■ ZtCObjNew 를 설계한 뜻에 비추어, + 위보다 아래 코드가 더 적합해 보인다. + 만약 위 코드의 동작을 수행하려면 + + **this = *rhs + + 처럼 하면 된다. -- 2025-10-05 21:42 + + //////////////////////////////////////////////*/ + if(--mp_StTypeRefCnt->MI_RefCount <= 0) + this->ZCAllocator::FiniMem(mp_StTypeRefCnt); + + mp_StTypeRefCnt = rhs.mp_StTypeRefCnt ; + ++mp_StTypeRefCnt->MI_RefCount ; + #endif + return *this; /*::::::::::::::::::::::::::::::*/ }/* ZtCObjNew& operator=(const ZtCObjNew& rhs)*/ @@ -4627,7 +4645,7 @@ namespace ZNsMain operator TypeData& (){return mp_StTypeRefCnt->MO_TypeData;} ZTypInt GetRefCnt () const{return mp_StTypeRefCnt->MI_RefCount;} - TypeData* GetObjPtr () const{return &mp_StTypeRefCnt->MO_TypeData;} + TypeData& GetObjRef () const{return &mp_StTypeRefCnt->MO_TypeData;} public : };/*