commit 2025-09-27 00:58 add ZtCTypeData< ZtCRef<TType> > and ZtCTypeData< ZtCRef<TType>* >

This commit is contained in:
2025-09-27 00:58:21 +09:00
parent 3cbcc8df6c
commit 9ca7dd3a90
3 changed files with 61 additions and 16 deletions

View File

@ -1211,6 +1211,18 @@ namespace ZNsMain
{ public: typedef ZfpNone TypeData;
static ZfpNone GetObjRef(void* AP_Void){return ZfNone ;}};
template<typename TType> class ZtCTypeData< ZtCRef<TType> >
{ public: typedef TType TypeData; static TType&
GetObjRef(ZtCRef<TType>& AR_CRef)
{return AR_CRef.GetData() /*//////////////*/ ;}
};
template<typename TType> class ZtCTypeData< ZtCRef<TType>* >
{ public: typedef TType TypeData; static TType&
GetObjRef(ZtCRef<TType>* AP_CRef)
{return *reinterpret_cast<TypeData*>(AP_CRef);}
};
template<typename TType> class ZtCTD
{ public: typedef TType TypeData;
static TType& GetObjRef(TType& AR_Type){return AR_Type ;}
@ -1229,6 +1241,21 @@ namespace ZNsMain
static ZfpNone GOR (void* AP_Void){return ZfNone ;}};
template<typename TType> class ZtCTD< ZtCRef<TType> >
{ public: typedef TType TypeData;
static TType& GetObjRef(ZtCRef<TType>& AR_CRef){return AR_CRef.GetData() ;}
static TType& GOR (ZtCRef<TType>& AR_CRef){return AR_CRef.GetData() ;}
};
template<typename TType> class ZtCTD< ZtCRef<TType>* >
{ public: typedef TType TypeData;
static TType& GetObjRef(ZtCRef<TType>* AP_CRef)
{return *reinterpret_cast<TypeData*>(AP_CRef);}
static TType& GOR (ZtCRef<TType>* AP_CRef)
{return *reinterpret_cast<TypeData*>(AP_CRef);}
};
/*/////////////////////////////////////////////////////////////////////////////////////////////
■ template 인수가 Type11 까지 있음에 주의한다. 그러면 Type10 까지 전문화할 수 있는 것이다.

View File

@ -2328,6 +2328,8 @@ namespace ZNsMain
/* 위 코드로 인해서, AO_Functor 이 함수일 때 뿐이 아니라,
operator() 연산자를 가진 object 포인터일 때도 사용할 수
있게 되었다.
이제는 ZftMCP() 템플릿 함수를 사용해도 된다. -- 2025-09-27 00:38
*/
VP_LoopLink = VP_LoopLink->mp_NextLink ;
}/*

View File

@ -19,20 +19,44 @@ namespace ZNsMain
{
public:
typedef ZtCStringBase<char> CStringBase ;
typedef const CStringBase CCStringBase;
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
ZtCSimList<CStringBase&, CCStringBase&>
ZtCSimList<CStringBase&, CCCStringBase&>
*/
typedef ZtCSimList
<CStringBase, CStringBase&> CStringList1 ;
typedef ZtCSimList
<CStringBase, CCStringBase&> CStringList2 ;
class CHelpObj
{
public:
int mi_CallNo;
public:
CHelpObj()
CHelpObj() : mi_CallNo(0)
{
cout<<"* CHelpObj()"<<endl;
}
CHelpObj(const CHelpObj& rhs)
CHelpObj(const CHelpObj& rhs) : mi_CallNo(0)
{
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
}
void operator()( CStringBase& AR_DataCStr)
{ cout<<"# CallNo="<<++mi_CallNo<<" : "<<AR_DataCStr<<endl; }
void operator()(CCStringBase& AR_DataCStr)
{ cout<<"# CallNo="<<++mi_CallNo<<" : "<<AR_DataCStr<<endl; }
public:
};/*
class CHelpObj*/
@ -71,20 +95,6 @@ namespace ZNsMain
public:
typedef ZtCStringBase<char> CStringBase ;
typedef const CStringBase CCStringBase;
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
ZtCSimList<CStringBase&, CCStringBase&>
ZtCSimList<CStringBase&, CCCStringBase&>
*/
typedef ZtCSimList
<CStringBase, CStringBase&> CStringList1 ;
typedef ZtCSimList
<CStringBase, CCStringBase&> CStringList2 ;
static void ShowDataInNode(const CStringBase& AR_Data)
{
@ -216,6 +226,12 @@ namespace ZNsMain
cout<<"# list11 IterElement ####" <<endl;*/
cout<<"# list11 IterElement : ZftMCR(CHelpObj)" <<endl;
VO_ListOfStr11.IterElement(ZftMCR(VO_CHelpObj));
cout<<"# list11 IterElement : ZftMCP(CHelpObj)" <<endl;
VO_ListOfStr11.IterElement(ZftMCP(VO_CHelpObj));
return 0;
}/*
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/