commit 2025-08-31 01:34 refine class ZtCMoveObj in ZCppMain/ZtCStringEx.H

This commit is contained in:
2025-08-31 13:35:05 +09:00
parent a57179f7bb
commit b5a6a5c944
4 changed files with 501 additions and 271 deletions

View File

@ -784,8 +784,10 @@ namespace ZNsMain
template<typename ZtpType> class ZtCRef template<typename ZtpType> class ZtCRef
{ {
public : public :
typedef ZtpType& TypeData; typedef ZtpType& TypeData ;
typedef ZtpType TypeRaw ; typedef ZtpType& TypeRef ;
typedef ZtpType TypeRaw ;
typedef ZtpType TypeConst;
private: private:
TypeData mr_Data; TypeData mr_Data;
public : public :
@ -796,6 +798,40 @@ namespace ZNsMain
};/* };/*
template<typename ZtpType> class ZtCRef*/ template<typename ZtpType> class ZtCRef*/
template<typename ZtpType> class ZtCRef<ZtpType&>
{
public :
typedef ZtpType& TypeData ;
typedef ZtpType& TypeRef ;
typedef ZtpType TypeRaw ;
typedef const ZtpType& TypeConst;
private:
TypeRaw& mr_Data;
public :
ZtCRef(TypeRef ZArTypeData) : mr_Data(ZArTypeData){}
public :
TypeRef GetData(){return mr_Data;}
public :
};/*
template<typename ZtpType> class ZtCRef<ZtpType&>*/
template<typename ZtpType> class ZtCRef<const ZtpType&>
{
public :
typedef const ZtpType& TypeData ;
typedef const ZtpType& TypeRef ;
typedef const ZtpType TypeRaw ;
typedef const ZtpType& TypeConst;
private:
TypeRaw& mr_Data;
public :
ZtCRef(TypeRef ZArTypeData) : mr_Data(ZArTypeData){}
public :
TypeRef GetData(){return mr_Data;}
public :
};/*
template<typename ZtpType> class ZtCRef<const ZtpType&>*/
template<typename ZtpType> inline ZtCRef<ZtpType> template<typename ZtpType> inline ZtCRef<ZtpType>
ZftMakeCRef(ZtpType& ZArTypeData){ return ZtCRef<ZtpType> (ZArTypeData );} ZftMakeCRef(ZtpType& ZArTypeData){ return ZtCRef<ZtpType> (ZArTypeData );}
@ -902,6 +938,19 @@ namespace ZNsMain
template<typename TType> class ZtCCheckRef< ZtCRef<TType>* >*/ template<typename TType> class ZtCCheckRef< ZtCRef<TType>* >*/
template<typename TType> class ZtCCheckConstRef
{
public: enum {ZEConstRef = 0};
};/*
template<typename ZtpType> class ZtCRef*/
template<typename TType> class ZtCCheckConstRef<const TType&>
{
public: enum {ZEConstRef = 1};
};/*
template<typename TType> class ZtCCheckConstRef<const TType&>*/
namespace ZNsType namespace ZNsType
{ {
@ -1298,6 +1347,82 @@ namespace ZNsMain
/*###########################################################################################*/ /*###########################################################################################*/
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebCompareObj=true
>
class ZtCCompare /////////////////////////
{
public:
enum {ZEUseCompareObj=(ZTypIntE)TTypebCompareObj};
public:
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2)
{
#ifdef _DEBUG_CCOMPARE_EXEC
cout<<" ※※ ZtCCompare<TTypeArg1, TTypeArg2, true> is called."<<endl;
#endif //_DEBUG_CCOMPARE_EXEC
return AR_TypeArg1.Compare(AR_TypeArg2);
}/*
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2) */
public:
};/*
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebCompareObj=true
>
class ZtCCompare ///////////////////////*/
template<typename TTypeArg1, typename TTypeArg2
>
class ZtCCompare<TTypeArg1, TTypeArg2, false>
{
public:
enum {ZEUseCompareObj=0};
public:
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2)
{
return ZNsEnum::ZECompareResult_Equal;
}/*
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg1 AR_TypeArg1, TTypeArg2 AR_TypeArg2)*/
public:
};/*
template<typename TTypeArg1, typename TTypeArg2
>
class ZtCCompare<TTypeArg1, TTypeArg2, false> */
template<> class ZtCCompare<ZTypInt, ZTypInt, true>
{
public:
enum {ZEUseCompareObj=1};
public:
static ZTypInt Exec(ZTypInt AI_Int1, ZTypInt AI_Int2)
{
#ifdef _DEBUG_CCOMPARE_EXEC
cout<<" ※※ ZtCCompare<int, int, true> is called."<<endl;
#endif //_DEBUG_CCOMPARE_EXEC
return AI_Int1 - AI_Int2 ;
}/*
static ZTypInt Exec(ZTypInt AI_Int1, ZTypInt AI_Int2)*/
public:
};/*
template<> class ZtCCompare<ZTypInt, ZTypInt, true>*/
namespace ZNsHide namespace ZNsHide
{ {
/* 특정 클래스 안에서만 사용되어, 사용자가 그 존재를 알 필요가 없는 클래스를 둔다. */ /* 특정 클래스 안에서만 사용되어, 사용자가 그 존재를 알 필요가 없는 클래스를 둔다. */
@ -1566,147 +1691,80 @@ namespace ZNsMain
///////////////////////////////////////////////////////////////////////////*/ ///////////////////////////////////////////////////////////////////////////*/
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebCompareObj=true
>
class ZtCCompare /////////////////////////
{
public:
enum {ZEUseCompareObj=(ZTypIntE)TTypebCompareObj};
public:
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2)
{
#ifdef _DEBUG_CCOMPARE_EXEC
cout<<" ※※ ZtCCompare<TTypeArg1, TTypeArg2, true> is called."<<endl;
#endif //_DEBUG_CCOMPARE_EXEC
return AR_TypeArg1.Compare(AR_TypeArg2);
}/*
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2) */
public:
};/*
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebCompareObj=true
>
class ZtCCompare ///////////////////////*/
template<typename TTypeArg1, typename TTypeArg2
>
class ZtCCompare<TTypeArg1, TTypeArg2, false>
{
public:
enum {ZEUseCompareObj=0};
public:
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg11 AR_TypeArg1, TTypeArg22 AR_TypeArg2)
{
return ZNsEnum::ZECompareResult_Equal;
}/*
template<typename TTypeArg11, typename TTypeArg22>
static ZTypInt Exec(TTypeArg1 AR_TypeArg1, TTypeArg2 AR_TypeArg2)*/
public:
};/*
template<typename TTypeArg1, typename TTypeArg2
>
class ZtCCompare<TTypeArg1, TTypeArg2, false> */
template<> class ZtCCompare<ZTypInt, ZTypInt, true>
{
public:
enum {ZEUseCompareObj=1};
public:
static ZTypInt Exec(ZTypInt AI_Int1, ZTypInt AI_Int2)
{
#ifdef _DEBUG_CCOMPARE_EXEC
cout<<" ※※ ZtCCompare<int, int, true> is called."<<endl;
#endif //_DEBUG_CCOMPARE_EXEC
return AI_Int1 - AI_Int2 ;
}/*
static ZTypInt Exec(ZTypInt AI_Int1, ZTypInt AI_Int2)*/
public:
};/*
template<> class ZtCCompare<ZTypInt, ZTypInt, true>*/
/*/////////////////////////////////////////////
■ ZtCMoveObj<> 의 사용례는 CObjAVL.H 에 있다.
-- 2013-08-26 19:18:00
/////////////////////////////////////////////*/
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebMoveObj=true
>
class ZtCMoveObj /*###############################################*/
{
public:
enum {ZEUseMoveObj=(ZTypIntE)TTypebMoveObj};
public:
static void Exec(TTypeArg1& AR_TypeArg1, TTypeArg2& AR_TypeArg2)
{
#ifdef _DEBUG_MOVEOBJ_EXEC
cout<<" ※※ ZtCMoveObj<TTypeArg1, TTypeArg2, true> is called."<<endl;
#endif //_DEBUG_MOVEOBJ_EXEC
ZNsFunc::ZftMoveFast(AR_TypeArg1, AR_TypeArg2);
}/*
static void Exec(TTypeArg1& AR_TypeArg1, TTypeArg2& AR_TypeArg2)*/
public:
};/*
template< typename TTypeArg1,
typename TTypeArg2,
bool TTypebMoveObj=true
>
class ZtCMoveObj #################################################*/
template /*######################################################*/
<
typename TTypeArg1, typename TTypeArg2
>
class ZtCMoveObj<TTypeArg1, TTypeArg2, false> /*##################*/
{
public:
enum {ZEUseMoveObj=0};
public:
static void Exec(TTypeArg1& AR_TypeArg1, TTypeArg2& AR_TypeArg2)
{
AR_TypeArg1 = AR_TypeArg2 ;
}/*
static void Exec(TTypeArg1& AR_TypeArg1, TTypeArg2& AR_TypeArg2)*/
public:
};/*
template ###########################################################
<
typename TTypeArg1, typename TTypeArg2
>
class ZtCMoveObj<TTypeArg1, TTypeArg2, false> ####################*/
}/* }/*
namespace ZNsFunc*/ namespace ZNsFunc*/
/*/////////////////////////////////////////////
■ ZtCMoveObj<> 의 사용례는 CObjAVL.H 에 있다.
-- 2013-08-26 19:18:00
/////////////////////////////////////////////*/
template< typename TTypeArg1 ,
typename TTypeArg2 ,
bool TTypebMoveObj=true
>
class ZtCMoveObj /*###############################################*/
{
public:
enum {ZEUseMoveObj = (ZTypIntE)TTypebMoveObj} ;
public:
typedef typename ZNsMain::ZtCRef<TTypeArg1>::TypeRef TypeRef1;
typedef typename ZNsMain::ZtCRef<TTypeArg2>::TypeRef TypeRef2;
public:
static void Exec(TypeRef1 AR_TypeArg1, TypeRef2 AR_TypeArg2)
{
#ifdef _DEBUG_MOVEOBJ_EXEC
cout<<" ※※ ZtCMoveObj<TTypeArg1, TTypeArg2, true> is called."<<endl;
#endif //_DEBUG_MOVEOBJ_EXEC
ZNsFunc::ZftMoveFast(AR_TypeArg1, AR_TypeArg2);
}/*
static void Exec(TTypeArg1& AR_TypeArg1, TTypeArg2& AR_TypeArg2)*/
public:
};/*
template< typename TTypeArg1 ,
typename TTypeArg2 ,
bool TTypebMoveObj=true
>
class ZtCMoveObj #################################################*/
template /*######################################################*/
<
typename TTypeArg1, typename TTypeArg2
>
class ZtCMoveObj<TTypeArg1, TTypeArg2, false> /*//////////////////*/
{
public:
enum {ZEUseMoveObj=0};
public:
typedef typename ZNsMain::ZtCRef<TTypeArg1>::TypeRef TypeRef1;
typedef typename ZNsMain::ZtCRef<TTypeArg2>::TypeRef TypeRef2;
public:
static void Exec(TypeRef1 AR_TypeArg1, TypeRef2 AR_TypeArg2)
{
AR_TypeArg1 = AR_TypeArg2 ;
}/*
static void Exec(TypeRef1 AR_TypeArg1, TypeRef2 AR_TypeArg2)*/
public:
};/*
template ###########################################################
<
typename TTypeArg1, typename TTypeArg2
>
class ZtCMoveObj<TTypeArg1, TTypeArg2, false> ////////////////////*/
namespace ZNsTmplChain namespace ZNsTmplChain
{ {

View File

@ -15,13 +15,13 @@ namespace ZNsMain
■ 이 AVL tree 는 각 노드가 트리 구조를 이루며, 동시에 이중 원형 연결리스트를 이루고 있다. ■ 이 AVL tree 는 각 노드가 트리 구조를 이루며, 동시에 이중 원형 연결리스트를 이루고 있다.
자료를 기본적으로 오름차순 정렬한다. 자료를 기본적으로 오름차순 정렬한다.
■ Type 자료형에는 <,>,== 연산이 가능해야 한다. TType 자료형에는 <,>,== 연산이 가능해야 한다.
■ 어떤 클래스에 비교연산자를 정의할 때 bool operator>(const CStringHash& rhs) const 와 같 ■ 어떤 클래스에 비교연산자를 정의할 때 bool operator>(const CStringHash& rhs) const 와 같
이 하면 인수에도 const, 멤버함수에도 const 를 잊지 말 것. 이 하면 인수에도 const, 멤버함수에도 const 를 잊지 말 것.
■ 접미어 Key 가 붙어있는 멤버 함수는 Type 보다는 크기가 작은 어떤 자료형이다. 삽입, 삭제 ■ 접미어 Key 가 붙어있는 멤버 함수는 TType 보다는 크기가 작은 어떤 자료형이다. 삽입, 삭제
시에 메모리를 절약하기 위해서 사용한다. Type 자료형과 Key 자료형 사이에는 <,>,==,= 의 연 시에 메모리를 절약하기 위해서 사용한다. TType 자료형과 Key 자료형 사이에는 <,>,==,= 의 연
산이 가능해야 한다. 산이 가능해야 한다.
■ multi set 으로 활용하는 코드는 MainAVL.H 파일의 주석에 예시하였다. typename TNodeBase 를 ■ multi set 으로 활용하는 코드는 MainAVL.H 파일의 주석에 예시하였다. typename TNodeBase 를
@ -30,19 +30,19 @@ namespace ZNsMain
/////////////////////////////////////////////////////////////////////////////////////////*/ /////////////////////////////////////////////////////////////////////////////////////////*/
template< typename Type , template< typename TType ,
typename TTypArg =const Type& , typename TTypArg =const TType& ,
typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> , typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> ,
typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> , typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> ,
typename TAlloc =ZNsMain::ZCAllocator , typename TAlloc =ZNsMain::ZCAllocator ,
typename TSize =ZNsMain::ZTypLong , typename TSize =ZNsMain::ZTypLong ,
typename TCompare =ZNsMain::ZNsFunc::ZtCCompare<TTypArg, TTypArg, false>, typename TCompare =ZNsMain::ZtCCompare<TTypArg, TTypArg, false> ,
typename TMoveObj =ZNsMain::ZNsFunc::ZtCMoveObj<TTypArg, TTypArg, true > typename TMoveObj =ZNsMain::ZtCMoveObj<TType , TTypArg, true >
> >
class ZtCObjAVL : public TTypBase /////////////////////////////////////////////////////// class ZtCObjAVL : public TTypBase ///////////////////////////////////////////////////////
{ {
public: public:
typedef Type TypeData ; typedef TType TypeData ;
typedef TTypArg TypeArg ; typedef TTypArg TypeArg ;
typedef TTypBase TypeBase ; typedef TTypBase TypeBase ;
typedef TNodeBase TypeNodeBase; typedef TNodeBase TypeNodeBase;
@ -64,7 +64,7 @@ namespace ZNsMain
ZCNode* mp_RighNode; /* 오른쪽 노드 */ ZCNode* mp_RighNode; /* 오른쪽 노드 */
ZCNode* mp_HighNode; /* 상위 노드 */ ZCNode* mp_HighNode; /* 상위 노드 */
Type mo_Type ; TType mo_Data ;
int mi_Balance ; int mi_Balance ;
/* 오른쪽 노드에 삽입될 때마다 mi_Balance 는 1 씩 증가하고 /* 오른쪽 노드에 삽입될 때마다 mi_Balance 는 1 씩 증가하고
@ -224,15 +224,16 @@ namespace ZNsMain
}/* }/*
bool IsFullNode() const*/ bool IsFullNode() const*/
TTypArg GetData() const typename ZtCRef<TTypArg>::TypeConst GetData() const
{ {
return mo_Type; return mo_Data;
}/* }/*
TTypArg GetData() const*/ typename ZtCRef<TTypArg>::TypeConst GetData() const*/
bool operator==(TTypArg AR_Type) const{return mo_Type==AR_Type;}
bool operator> (TTypArg AR_Type) const{return mo_Type> AR_Type;} bool operator==(TTypArg AR_Type) const{return mo_Data==AR_Type;}
bool operator< (TTypArg AR_Type) const{return mo_Type< AR_Type;} bool operator> (TTypArg AR_Type) const{return mo_Data> AR_Type;}
bool operator< (TTypArg AR_Type) const{return mo_Data< AR_Type;}
template<typename TFunctor> static void IterInOrder (ZCNode* AP_Node, TFunctor AO_Functor) template<typename TFunctor> static void IterInOrder (ZCNode* AP_Node, TFunctor AO_Functor)
{ {
@ -240,7 +241,7 @@ namespace ZNsMain
{ {
ZCNode::template IterInOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor); ZCNode::template IterInOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor);
{ {
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Type); ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Data);
} }
ZCNode::template IterInOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor); ZCNode::template IterInOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor);
}/* }/*
@ -252,7 +253,7 @@ namespace ZNsMain
{ {
if(AP_Node!=0) if(AP_Node!=0)
{ {
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Type); ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Data);
ZCNode::template IterPreOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor); ZCNode::template IterPreOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor);
ZCNode::template IterPreOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor); ZCNode::template IterPreOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor);
@ -268,7 +269,7 @@ namespace ZNsMain
ZCNode::template IterPostOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor); ZCNode::template IterPostOrder<TFunctor>(AP_Node->mp_LeftNode, AO_Functor);
ZCNode::template IterPostOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor); ZCNode::template IterPostOrder<TFunctor>(AP_Node->mp_RighNode, AO_Functor);
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Type); ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(AP_Node->mo_Data);
}/* }/*
if(AP_Node!=0)*/ if(AP_Node!=0)*/
}/* }/*
@ -285,7 +286,7 @@ namespace ZNsMain
(AP_Node->mp_LeftNode, AO_Functor, AR_HelpObj); (AP_Node->mp_LeftNode, AO_Functor, AR_HelpObj);
{ {
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(AP_Node->mo_Type, AR_HelpObj); GetObjRef(AO_Functor)(AP_Node->mo_Data, AR_HelpObj);
} }
ZCNode::template IterInOrder<TFunctor, THelpObj> ZCNode::template IterInOrder<TFunctor, THelpObj>
(AP_Node->mp_RighNode, AO_Functor, AR_HelpObj); (AP_Node->mp_RighNode, AO_Functor, AR_HelpObj);
@ -303,7 +304,7 @@ namespace ZNsMain
if(AP_Node!=0) if(AP_Node!=0)
{ {
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(AP_Node->mo_Type, AR_HelpObj); GetObjRef(AO_Functor)(AP_Node->mo_Data, AR_HelpObj);
ZCNode::template IterPreOrder ZCNode::template IterPreOrder
<TFunctor, THelpObj>(AP_Node->mp_LeftNode, AO_Functor, AR_HelpObj); <TFunctor, THelpObj>(AP_Node->mp_LeftNode, AO_Functor, AR_HelpObj);
@ -328,7 +329,7 @@ namespace ZNsMain
( AP_Node->mp_RighNode, AO_Functor, AR_HelpObj ); ( AP_Node->mp_RighNode, AO_Functor, AR_HelpObj );
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(AP_Node->mo_Type, AR_HelpObj); GetObjRef(AO_Functor)(AP_Node->mo_Data, AR_HelpObj);
}/* }/*
if(AP_Node!=0)*/ if(AP_Node!=0)*/
}/* }/*
@ -838,9 +839,9 @@ namespace ZNsMain
ZCNode* VP_Temp=rhs.mp_HeadNode ; ZCNode* VP_Temp=rhs.mp_HeadNode ;
ZCNode* VP_Tail=rhs.mp_HeadNode->mp_PrevNode; ZCNode* VP_Tail=rhs.mp_HeadNode->mp_PrevNode;
do /**/ do //////
{ {
AddData(VP_Temp->mo_Type); AddData(VP_Temp->mo_Data);
if(VP_Temp==VP_Tail) return; if(VP_Temp==VP_Tail) return;
@ -861,7 +862,7 @@ namespace ZNsMain
do ////// do //////
{ {
AddData(VP_Temp->mo_Type); AddData(VP_Temp->mo_Data);
if(VP_Temp==VP_Tail) return *this; if(VP_Temp==VP_Tail) return *this;
@ -986,7 +987,7 @@ namespace ZNsMain
do /**/ do /**/
{ {
DeleteData(VP_Temp->mo_Type); DeleteData(VP_Temp->mo_Data);
if(VP_Temp==VP_Tail) return *this; if(VP_Temp==VP_Tail) return *this;
@ -1060,11 +1061,11 @@ namespace ZNsMain
do /*#####*/ do /*#####*/
{ {
/* 아래 줄에서 VP_Temp->mo_Type 을 받는 인수는 /* 아래 줄에서 VP_Temp->mo_Data 을 받는 인수는
복사로 받거나 const Type& 으로 받아야 한다. */ 복사로 받거나 const TType& 으로 받아야 한다. */
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(VP_Temp->mo_Type); GetObjRef(AO_Functor)(VP_Temp->mo_Data);
if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode; if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode;
} }
@ -1082,11 +1083,11 @@ namespace ZNsMain
do /*#####*/ do /*#####*/
{ {
/* 아래 줄에서 VP_Temp->mo_Type 을 받는 인수는 /* 아래 줄에서 VP_Temp->mo_Data 을 받는 인수는
복사로 받거나 const Type& 으로 받아야 한다. */ 복사로 받거나 const TType& 으로 받아야 한다. */
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(VP_Temp->mo_Type, AO_HelpType) ; GetObjRef(AO_Functor)(VP_Temp->mo_Data, AO_HelpType) ;
if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode; if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode;
} }
@ -1106,7 +1107,7 @@ namespace ZNsMain
do /*#####*/ do /*#####*/
{ {
ZNsMain::ZtCTypeData<TFunctor>:: ZNsMain::ZtCTypeData<TFunctor>::
GetObjRef(AO_Functor)(VP_Temp->mo_Type, AR_HelpType) ; GetObjRef(AO_Functor)(VP_Temp->mo_Data, AR_HelpType) ;
if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode; if(VP_Temp==VP_Tail) return; VP_Temp=VP_Temp->mp_NextNode;
} }
@ -1143,12 +1144,21 @@ namespace ZNsMain
{ {
if(mp_RootNode==0) if(mp_RootNode==0)
{ {
mp_RootNode=new ZCNode ; mp_RootNode = new ZCNode ;
mp_HeadNode=mp_RootNode ; mp_HeadNode = mp_RootNode ;
ZCNode::MakeRing(mp_HeadNode, mp_HeadNode);
mp_RootNode->mo_Type=AR_Type;
++ml_NodeSize; return true; ZCNode::MakeRing(mp_HeadNode, mp_HeadNode);
#if(_CODE_NEW_)
if(TypeMoveObj::ZEUseMoveObj>0) /////////////////////
{
TypeMoveObj::Exec(mp_RootNode->mo_Data, AR_Type);
}
else ////////////////////////////////////////////////
#endif
mp_RootNode->mo_Data=AR_Type;
++ml_NodeSize; return true;
} }
else // mp_RootNode!=0 else // mp_RootNode!=0
{ {
@ -1168,7 +1178,7 @@ namespace ZNsMain
ZCNode::MakeRing(mp_HeadNode, mp_HeadNode); ZCNode::MakeRing(mp_HeadNode, mp_HeadNode);
mp_RootNode->mo_Type=AR_Key; ++ml_NodeSize; mp_RootNode->mo_Data=AR_Key; ++ml_NodeSize;
return mp_RootNode; /*///////////////////*/ return mp_RootNode; /*///////////////////*/
} }
@ -1197,7 +1207,7 @@ namespace ZNsMain
(void)CutNode(VP_FindNode); (void)CutNode(VP_FindNode);
VP_FindNode->mo_Type=AR_NewType; VP_FindNode->mo_Data=AR_NewType;
// 같은 값을 가진 노드가 있어서 삽입에 실패했다면, 잘라낸 노드를 지워버린다. // 같은 값을 가진 노드가 있어서 삽입에 실패했다면, 잘라낸 노드를 지워버린다.
@ -1228,7 +1238,7 @@ namespace ZNsMain
(void)CutNode(VP_FindNode); (void)CutNode(VP_FindNode);
VP_FindNode->mo_Type=AR_NewKey; VP_FindNode->mo_Data=AR_NewKey;
// 같은 키 값을 가진 노드가 있어서 삽입에 실패했다면, 잘라낸 노드를 지워버린다. // 같은 키 값을 가진 노드가 있어서 삽입에 실패했다면, 잘라낸 노드를 지워버린다.
@ -1305,7 +1315,7 @@ namespace ZNsMain
ZCNode* FindData(TTypArg AR_Type) const ZCNode* FindData(TTypArg AR_Type) const
{ {
/* mp_RootNode 부터 하위 노드로 순회하면서 /* mp_RootNode 부터 하위 노드로 순회하면서
mo_Type 를 가지는 노드를 찾는다. */ mo_Data 를 가지는 노드를 찾는다. */
return FindData(AR_Type, mp_RootNode); return FindData(AR_Type, mp_RootNode);
}/* }/*
@ -1315,7 +1325,7 @@ namespace ZNsMain
ZCNode* FindData(TTypArg AR_Type, ZCNode* AP_StartNode) const ZCNode* FindData(TTypArg AR_Type, ZCNode* AP_StartNode) const
{ {
/* AP_StartNode 부터 하위 노드로 순회하면서 /* AP_StartNode 부터 하위 노드로 순회하면서
mo_Type 를 가지는 노드를 찾는다. */ mo_Data 를 가지는 노드를 찾는다. */
#ifdef _DEBUG #ifdef _DEBUG
@ -1335,17 +1345,17 @@ namespace ZNsMain
while(AP_StartNode!=0) while(AP_StartNode!=0)
{ {
if(AP_StartNode->mo_Type==AR_Type) if (AP_StartNode->mo_Data == AR_Type)
{ {
return AP_StartNode; return AP_StartNode;
} }
else if(AP_StartNode->mo_Type>AR_Type) else if(AP_StartNode->mo_Data > AR_Type)
{ {
AP_StartNode=AP_StartNode->mp_LeftNode; AP_StartNode = AP_StartNode->mp_LeftNode;
} }
else else
{ {
AP_StartNode=AP_StartNode->mp_RighNode; AP_StartNode = AP_StartNode->mp_RighNode;
}/* }/*
else*/ else*/
}/* }/*
@ -1402,7 +1412,7 @@ namespace ZNsMain
■ AP_StartNode 부터 하위 노드로 순회하면서 AR_Key 를 가지는 노드를 찾는다. ■ AP_StartNode 부터 하위 노드로 순회하면서 AR_Key 를 가지는 노드를 찾는다.
FindData(TTypArg AR_Type,ZCNode* AP_StartNode) 같은 함수는 찾으려는 object 가 FindData(TTypArg AR_Type,ZCNode* AP_StartNode) 같은 함수는 찾으려는 object 가
AR_Type 이 크기가 큰 object 일 수 있는데, 이를 피하기 위해 그 보다 작은 크기 AR_Type 이 크기가 큰 object 일 수 있는데, 이를 피하기 위해 그 보다 작은 크기
의 자료형 TKey 로부터 해당 데이타를 찾는다. 물론 mo_Type 과 TKey 에 대한 비 의 자료형 TKey 로부터 해당 데이타를 찾는다. 물론 mo_Data 과 TKey 에 대한 비
교 연산이 정의되어 있어야 한다. 교 연산이 정의되어 있어야 한다.
//////////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////////*/
@ -1425,9 +1435,9 @@ namespace ZNsMain
while(AP_StartNode!=0) while(AP_StartNode!=0)
{ {
if(AP_StartNode->mo_Type==AR_Key) return AP_StartNode; if(AP_StartNode->mo_Data==AR_Key) return AP_StartNode;
if(AP_StartNode->mo_Type>AR_Key) if(AP_StartNode->mo_Data>AR_Key)
AP_StartNode=AP_StartNode->mp_LeftNode; AP_StartNode=AP_StartNode->mp_LeftNode;
else else
AP_StartNode=AP_StartNode->mp_RighNode; AP_StartNode=AP_StartNode->mp_RighNode;
@ -1449,7 +1459,7 @@ namespace ZNsMain
■ AP_StartNode 부터 하위 노드로 순회하면서 AR_Key 를 가지는 노드를 찾는다. ■ AP_StartNode 부터 하위 노드로 순회하면서 AR_Key 를 가지는 노드를 찾는다.
FindData(TTypArg AR_Type,ZCNode* AP_StartNode) 같은 함수는 찾으려는 object 가 FindData(TTypArg AR_Type,ZCNode* AP_StartNode) 같은 함수는 찾으려는 object 가
AR_Type 이 크기가 큰 object 일 수 있는데, 이를 피하기 위해 그 보다 작은 크기 AR_Type 이 크기가 큰 object 일 수 있는데, 이를 피하기 위해 그 보다 작은 크기
의 자료형 TKey 로부터 해당 데이타를 찾는다. 물론 mo_Type 과 TKey 에 대한 비 의 자료형 TKey 로부터 해당 데이타를 찾는다. 물론 mo_Data 과 TKey 에 대한 비
교 연산이 정의되어 있어야 한다. 교 연산이 정의되어 있어야 한다.
//////////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////////*/
@ -1472,9 +1482,9 @@ namespace ZNsMain
while(AP_StartNode!=0) while(AP_StartNode!=0)
{ {
if(AP_StartNode->mo_Type==AR_Key) return AP_StartNode; if(AP_StartNode->mo_Data==AR_Key) return AP_StartNode;
if(AP_StartNode->mo_Type>AR_Key) if(AP_StartNode->mo_Data>AR_Key)
AP_StartNode=AP_StartNode->mp_LeftNode; AP_StartNode=AP_StartNode->mp_LeftNode;
else else
AP_StartNode=AP_StartNode->mp_RighNode; AP_StartNode=AP_StartNode->mp_RighNode;
@ -1637,7 +1647,7 @@ namespace ZNsMain
if(CB_IsLess)*/ if(CB_IsLess)*/
// AR_Node.mo_Type>AR_Type) // AR_Node.mo_Data>AR_Type)
if(AR_Node.mp_LeftNode==0) if(AR_Node.mp_LeftNode==0)
{ {
@ -1775,7 +1785,7 @@ namespace ZNsMain
if(CB_IsLess)*/ if(CB_IsLess)*/
// AR_Node.mo_Type>AR_Type // AR_Node.mo_Data>AR_Type
if(AR_Node.mp_LeftNode==0) if(AR_Node.mp_LeftNode==0)
{ {
@ -1921,7 +1931,7 @@ namespace ZNsMain
if(CB_IsLess)*/ if(CB_IsLess)*/
// AR_Node.mo_Type>AR_Type) // AR_Node.mo_Data>AR_Type)
if(AR_Node.mp_LeftNode==0) if(AR_Node.mp_LeftNode==0)
{ {
@ -2002,10 +2012,10 @@ namespace ZNsMain
#if(_CODE_NEW_) #if(_CODE_NEW_)
if(TypeMoveObj::ZEUseMoveObj>0) if(TypeMoveObj::ZEUseMoveObj>0)
TypeMoveObj::Exec(VP_NewNode->mo_Type, AR_Type); TypeMoveObj::Exec(VP_NewNode->mo_Data, AR_Type);
else else
#endif #endif
VP_NewNode->mo_Type=AR_Type; VP_NewNode->mo_Data=AR_Type;
return JoinBefore(AP_StdNode, VP_NewNode); return JoinBefore(AP_StdNode, VP_NewNode);
}/* }/*
@ -2016,7 +2026,7 @@ namespace ZNsMain
{ {
ZCNode* VP_NewNode = new ZCNode; ZCNode* VP_NewNode = new ZCNode;
VP_NewNode->mo_Type = AR_Key ; VP_NewNode->mo_Data = AR_Key ;
return JoinBefore(AP_StdNode, VP_NewNode); return JoinBefore(AP_StdNode, VP_NewNode);
}/* }/*
@ -2055,10 +2065,10 @@ namespace ZNsMain
#if(_CODE_NEW_) #if(_CODE_NEW_)
if(TypeMoveObj::ZEUseMoveObj>0) if(TypeMoveObj::ZEUseMoveObj>0)
TypeMoveObj::Exec(VP_NewNode->mo_Type, AR_Type); TypeMoveObj::Exec(VP_NewNode->mo_Data, AR_Type);
else else
#endif #endif
VP_NewNode->mo_Type=AR_Type; VP_NewNode->mo_Data=AR_Type;
return JoinAfter(AP_StdNode, VP_NewNode); return JoinAfter(AP_StdNode, VP_NewNode);
}/* }/*
@ -2069,7 +2079,7 @@ namespace ZNsMain
{ {
ZCNode* VP_NewNode = new ZCNode; ZCNode* VP_NewNode = new ZCNode;
VP_NewNode->mo_Type= AR_Key ; VP_NewNode->mo_Data= AR_Key ;
return JoinAfter(AP_StdNode, VP_NewNode); return JoinAfter(AP_StdNode, VP_NewNode);
}/* }/*
@ -2356,14 +2366,14 @@ namespace ZNsMain
private: private:
};/* };/*
template< typename Type , template< typename TType ,
typename TTypArg =const Type& , typename TTypArg =const TType& ,
typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> , typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> ,
typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> , typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> ,
typename TAlloc =ZNsMain::ZCAllocator , typename TAlloc =ZNsMain::ZCAllocator ,
typename TSize =ZNsMain::ZTypLong , typename TSize =ZNsMain::ZTypLong ,
typename TCompare =ZNsMain::ZNsFunc::ZtCCompare<TTypArg, TTypArg, false>, typename TCompare =ZNsMain::ZtCCompare<TTypArg, TTypArg, false>,
typename TMoveObj =ZNsMain::ZNsFunc::ZtCMoveObj<TTypArg, TTypArg, true > typename TMoveObj =ZNsMain::ZtCMoveObj<TType , TTypArg, true >
> >
class ZtCObjAVL /////////////////////////////////////////////////////////////////////*/ class ZtCObjAVL /////////////////////////////////////////////////////////////////////*/
@ -2415,28 +2425,28 @@ namespace ZNsMain
namespace ZNsTmplParam namespace ZNsTmplParam
{ {
template< typename Type , template< typename TType ,
typename TTypArg =const Type& , typename TTypArg =const TType& ,
typename TCompare =ZNsMain::ZNsFunc ::ZtCCompare<TTypArg, TTypArg, true>, typename TCompare =ZNsMain::ZtCCompare<TTypArg, TTypArg, true>,
typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> , typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg>,
typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> , typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg>,
typename TAlloc =ZNsMain::ZCAllocator , typename TAlloc =ZNsMain::ZCAllocator ,
typename TSize =long , typename TSize =long ,
typename TMoveObj =ZNsMain::ZNsFunc::ZtCMoveObj<TTypArg, TTypArg, false> typename TMoveObj =ZNsMain::ZtCMoveObj<TType, TTypArg, false>
> >
class ZtCParamObjAVL_Compare ////////////////////////////////////////////////////////// class ZtCParamObjAVL_Compare //////////////////////////////////////////////////////////
{ {
public: typedef ZNsMain::ZtCObjAVL< public: typedef ZNsMain::ZtCObjAVL<
Type, TTypArg, TTypBase, TNodeBase, TAlloc, TSize, TCompare, TMoveObj> TypeData; TType, TTypArg, TTypBase, TNodeBase, TAlloc, TSize, TCompare, TMoveObj> TypeData;
};/* };/*
template< typename Type , template< typename TType ,
typename TTypArg =const Type& , typename TTypArg =const TType& ,
typename TCompare =ZNsMain::ZNsFunc ::ZtCCompare<TTypArg, TTypArg, true>, typename TCompare =ZNsMain::ZtCCompare<TTypArg, TTypArg, true>,
typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg> , typename TTypBase =ZNsMain::ZNsIFace::ZtCAVL_BASE <TTypArg>,
typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg> , typename TNodeBase =ZNsMain::ZNsIFace::ZtCAVL_NodeBase<TTypArg>,
typename TAlloc =ZNsMain::ZCAllocator , typename TAlloc =ZNsMain::ZCAllocator ,
typename TSize =long , typename TSize =long ,
typename TMoveObj =ZNsMain::ZNsFunc::ZtCMoveObj<TTypArg, TTypArg, false> typename TMoveObj =ZNsMain::ZtCMoveObj<TType, TTypArg, false>
> >
class ZtCParamObjAVL_Compare ////////////////////////////////////////////////////////*/ class ZtCParamObjAVL_Compare ////////////////////////////////////////////////////////*/

View File

@ -29,23 +29,26 @@ namespace ZNsMain
template<typename TypeObjList> class ZtCSortObjList; template<typename TypeObjList> class ZtCSortObjList;
template< typename TType , template< typename TType ,
typename TTypCArg =const TType&, typename TTypCArg = const TType&,
typename TTypCAlloc=ZCAllocator , typename TTypCAlloc = ZCAllocator ,
typename TTypCInit =ZCInit , typename TTypCInit = ZCInit ,
typename TTypSize =ZTypLong typename TTypSize = ZTypLong ,
typename TMoveObj = ZNsMain::
ZtCMoveObj<TType, TTypCArg, true>
> >
class ZtCObjList //////////////////////////// class ZtCObjList //////////////////////////////
{ {
public: public:
template<typename TypeObjList> friend class ZtCSortObjList; template<typename TypeObjList> friend class ZtCSortObjList;
public: public:
typedef TType Type ; typedef TType Type ;
typedef TType TypeData ; typedef TType TypeData ;
typedef TTypCArg TypeArg ; typedef TTypCArg TypeArg ;
typedef TTypCAlloc TypeAlloc; typedef TTypCAlloc TypeAlloc ;
//typedef TTypCInit TypeInit ; //typedef TTypCInit TypeInit ;
typedef TTypSize TypeSize ; typedef TTypSize TypeSize ;
typedef TMoveObj TypeMoveObj;
public: public:
class ZCIterator; class ZCIterator;
class ZCLink ; class ZCLink ;
@ -61,7 +64,7 @@ namespace ZNsMain
template<typename TypeObjList> friend class ZtCSortObjList; template<typename TypeObjList> friend class ZtCSortObjList;
/*##########################*/ friend class ZtCObjList ; /*##########################*/ friend class ZtCObjList ;
private: private:
TypeData mo_Type ; TypeData mo_Data ;
ZCLink* mp_NextLink; ZCLink* mp_NextLink;
ZCLink* mp_PrevLink; ZCLink* mp_PrevLink;
private: private:
@ -85,34 +88,42 @@ namespace ZNsMain
ZCLink() ZCLink()
{ {
mp_NextLink=0; mp_NextLink =0 ;
mp_PrevLink=0; mp_PrevLink =0 ;
}/* }/*
ZCLink()*/ ZCLink()*/
ZCLink(TypeArg AR_Type):mo_Type(AR_Type) ZCLink(TypeArg AR_Type)
{ {
mp_NextLink=0; mp_NextLink = 0 ;
mp_PrevLink=0; mp_PrevLink = 0 ;
mo_Data = AR_Type ;
}/* }/*
ZCLink(TypeArg AR_Type)*/ ZCLink(TypeArg AR_Type)*/
ZCLink(const ZCLink& rhs):mo_Type(rhs.mo_Type) ZCLink(const ZCLink& rhs)
{ {
mp_NextLink=0; mp_NextLink =0 ;
mp_PrevLink=0; mp_PrevLink =0 ;
mo_Data = rhs.mo_Data ;
}/* }/*
ZCLink(const ZCLink& rhs)*/ ZCLink(const ZCLink& rhs)*/
ZCLink& operator=(const ZCLink& rhs)
{
mo_Data = rhs.mo_Data; return *this;
}/*
ZCLink& operator=(const ZCLink& rhs)*/
operator Type& (){return mo_Type;}
operator Type (){return mo_Type;}
Type& GetData (){return mo_Type;}
Type& operator*(){return mo_Type;}
operator const Type& () const{return mo_Type;} operator Type& (){return mo_Data;}
const Type& GetData () const{return mo_Type;} operator Type (){return mo_Data;}
const Type& operator*() const{return mo_Type;} Type& GetData (){return mo_Data;}
Type& operator*(){return mo_Data;}
operator const Type& () const{return mo_Data;}
const Type& GetData () const{return mo_Data;}
const Type& operator*() const{return mo_Data;}
ZCLink* GetNextPrevPtr(TypeSize AL_FarNum) // AL_FarNum 은 0 이거나 음수일 수 있다. ZCLink* GetNextPrevPtr(TypeSize AL_FarNum) // AL_FarNum 은 0 이거나 음수일 수 있다.
@ -617,7 +628,7 @@ namespace ZNsMain
if(AL_FarNum>0) if(AL_FarNum>0)
{ {
APR_HeadLink= APR_HeadLink =
new ZCLink(AP_CopyLink->GetData()); new ZCLink(AP_CopyLink->GetData());
ZCLink* VP_TempLink=APR_HeadLink; ZCLink* VP_TempLink=APR_HeadLink;
@ -1136,6 +1147,18 @@ namespace ZNsMain
ZtCObjList& AddHead(TypeArg AR_Type) ZtCObjList& AddHead(TypeArg AR_Type)
{ {
#if(_CODE_NEW_)
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
{
ZCLink* VP_NewNode = new ZCLink;
TypeMoveObj::Exec(VP_NewNode->mo_Data, AR_Type);
JoinAfter(VP_NewNode, 0, 0); return *this;
}
////////////////////////////////////////////////////
#endif
JoinAfter(new ZCLink(AR_Type), 0, 0); return *this; JoinAfter(new ZCLink(AR_Type), 0, 0); return *this;
}/* }/*
ZtCObjList& AddHead(TypeArg AR_Type)*/ ZtCObjList& AddHead(TypeArg AR_Type)*/
@ -1153,6 +1176,18 @@ namespace ZNsMain
ZtCObjList& AddTail(TypeArg AR_Type) ZtCObjList& AddTail(TypeArg AR_Type)
{ {
#if(_CODE_NEW_)
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
{
ZCLink* VP_NewNode = new ZCLink;
TypeMoveObj::Exec(VP_NewNode->mo_Data, AR_Type);
JoinAfter(VP_NewNode, GetTailLinkPtr(), 0); return *this;
}
////////////////////////////////////////////////////
#endif
JoinAfter(new ZCLink(AR_Type), GetTailLinkPtr(), ml_Size); return *this; JoinAfter(new ZCLink(AR_Type), GetTailLinkPtr(), ml_Size); return *this;
}/* }/*
ZtCObjList& AddTail(TypeArg AR_Type)*/ ZtCObjList& AddTail(TypeArg AR_Type)*/
@ -1517,7 +1552,7 @@ namespace ZNsMain
__for0(TypeSize, i, ml_Size) __for0(TypeSize, i, ml_Size)
{ {
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(VP_LoopLink->mo_Type); ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)(VP_LoopLink->mo_Data);
/* 위 코드로 인해서, AO_Functor 이 함수일 때 뿐이 아니라, operator() /* 위 코드로 인해서, AO_Functor 이 함수일 때 뿐이 아니라, operator()
연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다. */ 연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다. */
@ -1561,7 +1596,7 @@ namespace ZNsMain
{ {
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor) ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
( (
VP_LoopLink->mo_Type, ZCCheckRef::PassData(AO_TypeHelp) VP_LoopLink->mo_Data, ZCCheckRef::PassData(AO_TypeHelp)
); );
//////////////////////////////////////////// ////////////////////////////////////////////
@ -1618,7 +1653,7 @@ namespace ZNsMain
{ {
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor) ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
( (
VP_LoopLink->mo_Type VP_LoopLink->mo_Data
, ZCCheckRef1::PassData(AO_TypeHelp1) , ZCCheckRef1::PassData(AO_TypeHelp1)
, ZCCheckRef2::PassData(AO_TypeHelp2) , ZCCheckRef2::PassData(AO_TypeHelp2)
); );
@ -1650,7 +1685,7 @@ namespace ZNsMain
__for0(TypeSize, i, ml_Size) __for0(TypeSize, i, ml_Size)
{ {
ZtCTypeData<TFunctor>::GetObjRef ZtCTypeData<TFunctor>::GetObjRef
(AO_Functor)(VP_LoopLink->mo_Type, AR_TypeHelp); (AO_Functor)(VP_LoopLink->mo_Data, AR_TypeHelp);
VP_LoopLink = VP_LoopLink->mp_NextLink ; VP_LoopLink = VP_LoopLink->mp_NextLink ;
}/* }/*
@ -1675,7 +1710,7 @@ namespace ZNsMain
__for0(TypeSize, i, ml_Size) __for0(TypeSize, i, ml_Size)
{ {
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor) ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
( VP_LoopLink->mo_Type, AR_TypeHelp1, AR_TypeHelp2 ); ( VP_LoopLink->mo_Data, AR_TypeHelp1, AR_TypeHelp2 );
VP_LoopLink = VP_LoopLink->mp_NextLink ; VP_LoopLink = VP_LoopLink->mp_NextLink ;
}/* }/*
@ -2124,13 +2159,15 @@ namespace ZNsMain
public: public:
};/* };/*
template< typename TType , template< typename TType ,
typename TTypCArg =const TType&, typename TTypCArg = const TType&,
typename TTypCAlloc=ZCAllocator , typename TTypCAlloc = ZCAllocator ,
typename TTypCInit =ZCInit , typename TTypCInit = ZCInit ,
typename TTypSize =ZTypLong typename TTypSize = ZTypLong ,
typename TMoveObj = ZNsMain::
ZtCMoveObj<TType, TTypArg, true>
> >
class ZtCObjList //////////////////////////*/ class ZtCObjList ////////////////////////////*/
/*///////////////////////////////////////////////////////////////////////////// /*/////////////////////////////////////////////////////////////////////////////

View File

@ -345,7 +345,7 @@ namespace ZNsMain
{ {
/* VP_CSearchInfo=&ARR_InfoList.AddTailDefault()->GetData(); /* VP_CSearchInfo=&ARR_InfoList.AddTailDefault()->GetData();
위 코드처럼 하면 ARR_InfoList 를 일반화 하기가 어렵다. */ 위 코드처럼 하면 ARR_InfoList 를 일반화하기가 어렵다. */
VP_CSearchInfo= &(ZCSearchInfo&)ARR_InfoList; VP_CSearchInfo= &(ZCSearchInfo&)ARR_InfoList;
VP_CSearchInfo->mp_Char= VP_Origin+i ; VP_CSearchInfo->mp_Char= VP_Origin+i ;
@ -1679,7 +1679,7 @@ namespace ZNsMain
} }
else if(AL_ReplaceLen<AL_SearchLen) else if(AL_ReplaceLen<AL_SearchLen)
{ {
VL_Index=VO_CSearchInfoList.GetHeadData().ml_Pos; VL_Index = VO_CSearchInfoList.GetHeadData().ml_Pos;
for(TypeLength i=1; i<=VL_InfoEntrySize; ++i) for(TypeLength i=1; i<=VL_InfoEntrySize; ++i)
{ {
@ -8314,9 +8314,94 @@ namespace ZNsMain
#if (_CODE_OLD_)
template ////////////////////////////////////////////////////////////
<
template<typename, typename, typename, typename>
class ZtCStringBase,
typename TTypCh , typename TAlloc,
typename TAllocSize, typename TTypeString
>
class ZtCMoveObj /*################################################*/
<
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString> ,
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString>&, true
>
/////////////////////////////////////////////////////////////////////
{
public:
typedef ZtCStringBase
<TTypCh, TAlloc, TAllocSize, TTypeString> ZCStringBase;
public:
enum {ZEUseMoveObj = 1};
public:
static void Exec(ZCStringBase& AR_TypeArg1, ZCStringBase& AR_TypeArg2)
{
AR_TypeArg1.Fetch(AR_TypeArg2) ;
}/*
static void Exec(ZCStringBase& AR_TypeArg1, ZCStringBase& AR_TypeArg2)*/
public:
};/*
class ZtCMoveObj ##################################################*/
#endif //_CODE_OLD_
#if (_CODE_NEW_)
template
<
typename TTypCh , typename TAlloc,
typename TAllocSize, typename TTypeString
>
class ZtCMoveObj /*################################################*/
<
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString> ,
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString>&, true
>
/////////////////////////////////////////////////////////////////////
{
public:
typedef ZtCStringBase
<TTypCh, TAlloc, TAllocSize, TTypeString> ZCStringBase;
public:
enum {ZEUseMoveObj = 1};
public:
static void Exec(ZCStringBase& AR_TypeArg1, ZCStringBase& AR_TypeArg2)
{
AR_TypeArg1.Fetch(AR_TypeArg2) ;
}/*
static void Exec(ZCStringBase& AR_TypeArg1, ZCStringBase& AR_TypeArg2)*/
public:
};/*
template
<
typename TTypCh , typename TAlloc,
typename TAllocSize, typename TTypeString
>
class ZtCMoveObj /*##################################################
<
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString> ,
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString>&, true
>
///////////////////////////////////////////////////////////////////*/
#endif //_CODE_NEW_
namespace ZNsFunc namespace ZNsFunc
{ {
#if (_CODE_OLD_)
template ////////////////////////////////////////////////////////////////// template //////////////////////////////////////////////////////////////////
< <
typename TTypCh , typename TAlloc, typename TTypCh , typename TAlloc,
@ -8345,9 +8430,49 @@ namespace ZNsMain
> >
void ZftMoveFast ////////////////////////////////////////////////////////*/ void ZftMoveFast ////////////////////////////////////////////////////////*/
#endif //_CODE_OLD_
#if (_CODE_BAD_)
template //////////////////////////////////////////////////////////////////
<
template<typename, typename, typename, typename>
class ZtCStringBase,
typename TTypCh , typename TAlloc,
typename TAllocSize, typename TTypeString
>
void ZftMoveFast //////////////////////////////////////////////////////////
(
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString>& AR_CString1,
ZtCStringBase<TTypCh, TAlloc, TAllocSize, TTypeString>& AR_CString2,
)
{
#ifdef _DEBUG_FAST_MOVE_OBJ_
cout<<" ▶▶ ZftMoveFast(ZCString&, ZCString&) Start!"<<endl;
#endif //_DEBUG_FAST_MOVE_OBJ_
AR_CString1.Fetch(AR_CString2);
#ifdef _DEBUG_FAST_MOVE_OBJ_
cout<<" ▶▶ ZftMoveFast(ZCString&, ZCString&) Close!"<<endl;
#endif //_DEBUG_FAST_MOVE_OBJ_
}/*
template //////////////////////////////////////////////////////////////////
<
typename TTypCh , typename TAlloc,
typename TAllocSize, typename TTypeString
>
void ZftMoveFast ////////////////////////////////////////////////////////*/
#endif //_CODE_BAD_
}/* }/*
namespace ZNsFunc*/ namespace ZNsFunc*/
}/* }/*
namespace ZNsMain */ namespace ZNsMain */