commit 2025-08-31 01:34 refine class ZtCMoveObj in ZCppMain/ZtCStringEx.H
This commit is contained in:
@ -784,8 +784,10 @@ namespace ZNsMain
|
||||
template<typename ZtpType> class ZtCRef
|
||||
{
|
||||
public :
|
||||
typedef ZtpType& TypeData;
|
||||
typedef ZtpType TypeRaw ;
|
||||
typedef ZtpType& TypeData ;
|
||||
typedef ZtpType& TypeRef ;
|
||||
typedef ZtpType TypeRaw ;
|
||||
typedef ZtpType TypeConst;
|
||||
private:
|
||||
TypeData mr_Data;
|
||||
public :
|
||||
@ -796,6 +798,40 @@ namespace ZNsMain
|
||||
};/*
|
||||
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>
|
||||
ZftMakeCRef(ZtpType& ZArTypeData){ return ZtCRef<ZtpType> (ZArTypeData );}
|
||||
@ -902,6 +938,19 @@ namespace ZNsMain
|
||||
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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
/* 특정 클래스 안에서만 사용되어, 사용자가 그 존재를 알 필요가 없는 클래스를 둔다. */
|
||||
@ -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*/
|
||||
|
||||
|
||||
|
||||
/*/////////////////////////////////////////////
|
||||
|
||||
■ 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
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user