edit test.cpp
This commit is contained in:
@ -1011,6 +1011,8 @@ namespace ZNsMain
|
||||
ZtCCheckRef(TypeData AR_TypeData) : mr_Data(AR_TypeData){}
|
||||
public :
|
||||
TypeData GetData(){return mr_Data;}
|
||||
public :
|
||||
static TypeData PassData(TypeData AO_Data){return AO_Data;}
|
||||
};/*
|
||||
template<typename TType> class ZtCCheckRef*/
|
||||
|
||||
@ -1018,14 +1020,20 @@ namespace ZNsMain
|
||||
template<typename TType> class ZtCCheckRef< ZtCRef<TType> >
|
||||
{
|
||||
public :
|
||||
typedef TType& TypeData;
|
||||
typedef TType TypeRaw ;
|
||||
typedef TType& TypeData;
|
||||
typedef TType TypeRaw ;
|
||||
typedef ZtCRef<TType> ZCRef ;
|
||||
private:
|
||||
TypeData mr_Data;
|
||||
public :
|
||||
ZtCCheckRef(TypeData AR_TypeData) : mr_Data(AR_TypeData){}
|
||||
public :
|
||||
TypeData GetData(){return mr_Data;}
|
||||
public :
|
||||
static TypeData PassData(TypeData AO_Data){return AO_Data;}
|
||||
static TypeData PassData(ZCRef& AO_Data){return AO_Data.GetData();}
|
||||
static TypeData PassData(const ZCRef& AO_Data)
|
||||
{return (const_cast<ZCRef>(AO_Data)).GetData();}
|
||||
};/*
|
||||
template<typename TType> class ZtCCheckRef< ZtCRef<TType> >*/
|
||||
|
||||
|
@ -424,10 +424,13 @@ namespace ZNsMain
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::
|
||||
GetObjRef(AO_Functor)(*VP_TypeArr); ++VP_TypeArr;
|
||||
GetObjRef(AO_Functor)( *VP_TypeArr );
|
||||
|
||||
/* 위 코드로 인해서, AO_Functor 이 함수일 때 뿐이 아니라,
|
||||
operator() 연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다. */
|
||||
++VP_TypeArr;
|
||||
|
||||
/* ZtCTypeData 으로 인해서, AO_Functor 이 함수일 때 뿐이 아니라,
|
||||
operator() 연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다.
|
||||
*/
|
||||
}/*
|
||||
__for0(TypeSize, i, ml_UseSize)*/
|
||||
}/*
|
||||
@ -455,12 +458,14 @@ namespace ZNsMain
|
||||
|
||||
형태를 사용하면 좋을 것 같다. -- 2014-06-16 23:11:00
|
||||
|
||||
|
||||
ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해 인수를 참조
|
||||
로 넘길 수 있게 되었다. -- 2021-03-10 16:56
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
|
||||
typedef ZNsMain::
|
||||
ZtCTypeData<TTypeHelp> ZCTypeHelp;
|
||||
|
||||
ZtCCheckRef<TTypeHelp> ZCCheckRef;
|
||||
|
||||
Type* VP_TypeArr = mp_TypeArr;
|
||||
|
||||
@ -468,7 +473,7 @@ namespace ZNsMain
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
*VP_TypeArr, AO_TypeHelp
|
||||
*VP_TypeArr, ZCCheckRef::PassData(AO_TypeHelp)
|
||||
);
|
||||
++VP_TypeArr; ///////////////////////////////////////
|
||||
}/*
|
||||
@ -498,15 +503,22 @@ namespace ZNsMain
|
||||
|
||||
형태를 사용하면 좋을 것 같다. -- 2014-06-16 23:11:00
|
||||
|
||||
|
||||
ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해 인수를 참조
|
||||
로 넘길 수 있게 되었다. -- 2021-03-10 16:56
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp1> ZCCheckRef1;
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp2> ZCCheckRef2;
|
||||
|
||||
Type* VP_TypeArr = mp_TypeArr;
|
||||
|
||||
__for0(TypeSize, i, ml_UseSize)
|
||||
{
|
||||
ZNsMain::ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
*VP_TypeArr, AO_TypeHelp1, AO_TypeHelp2
|
||||
*VP_TypeArr, ZCCheckRef1::PassData(AO_TypeHelp1), ZCCheckRef2(AO_TypeHelp2)
|
||||
);
|
||||
++VP_TypeArr; ///////////////////////////////////////
|
||||
}/*
|
||||
|
@ -1526,19 +1526,25 @@ namespace ZNsMain
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
typedef ZNsMain::
|
||||
ZtCCheckRef<TTypeHelp> ZCCheckRef;
|
||||
|
||||
ZCLink* VP_LoopLink=mp_HeadLink;
|
||||
|
||||
__for0(int, i, ml_Size)
|
||||
{
|
||||
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
VP_LoopLink->mo_Type, AO_TypeHelp
|
||||
VP_LoopLink->mo_Type, ZCCheckRef::PassData(AO_TypeHelp)
|
||||
);
|
||||
////////////////////////////////////////////
|
||||
|
||||
/* 위 코드로 인해서, AO_Functor 이 함수일 때 뿐이 아니라, operator()
|
||||
연산자를 가진 object 포인터일 때도 사용할 수 있게 되었다. */
|
||||
|
||||
/* ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해
|
||||
인수를 참조로 넘길 수 있게 되었다. -- 2021-03-10 16:56 */
|
||||
|
||||
VP_LoopLink = VP_LoopLink->mp_NextLink ;
|
||||
}/*
|
||||
__for0(int, i, ml_Size)*/
|
||||
@ -1569,13 +1575,17 @@ namespace ZNsMain
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp1> ZCCheckRef1;
|
||||
typedef ZNsMain::ZtCCheckRef<TTypeHelp2> ZCCheckRef2;
|
||||
|
||||
|
||||
ZCLink* VP_LoopLink=mp_HeadLink;
|
||||
|
||||
__for0(int, i, ml_Size)
|
||||
{
|
||||
ZtCTypeData<TFunctor>::GetObjRef(AO_Functor)
|
||||
(
|
||||
VP_LoopLink->mo_Type, AO_TypeHelp1, AO_TypeHelp2
|
||||
VP_LoopLink->mo_Type, ZCCheckRef1::PassData(AO_TypeHelp1), ZCCheckRef2::PassData(AO_TypeHelp2)
|
||||
);
|
||||
////////////////////////////////////////////
|
||||
|
||||
|
@ -182,6 +182,22 @@ int main(int ArgiCnt, char** AppArgu)
|
||||
(ZTypInt AiInt, ZCTuple* AP_CTuple)*/
|
||||
_FFC_(ZCShowData4)
|
||||
|
||||
_FFS_(ZCShowData5)
|
||||
(ZTypInt AiInt, int& AiIndex)
|
||||
{
|
||||
cout<<"# Elem5 : "<< AiInt << ", nth=" << AiIndex++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, int& AiIndex)*/
|
||||
_FFC_(ZCShowData5)
|
||||
|
||||
_FFS_(ZCShowData6)
|
||||
(ZTypInt AiInt, int& AiIndex)
|
||||
{
|
||||
cout<<"# Elem6 : "<< AiInt << ", nth=" << AiIndex++ << endl;
|
||||
}/*
|
||||
(ZTypInt AiInt, int& AiIndex)*/
|
||||
_FFC_(ZCShowData6)
|
||||
|
||||
|
||||
ZNsHide::ZCFunctor1 VO_CFunctor1;
|
||||
/* ZCFunctor1 선언이 main() 바깥에 있어야 하는 문제를 해결할 수 없을까. */
|
||||
@ -191,7 +207,9 @@ int main(int ArgiCnt, char** AppArgu)
|
||||
VO_IntList.IterElement(ZCShowData3::Exec, &VO_CTuple);
|
||||
VO_IntList.IterElement(&VO_CFunctor1 );
|
||||
VO_IntArr .IterElement(&VO_CFunctor1 ); VO_CTuple._1=1 ;
|
||||
VO_IntArr .IterElement(ZCShowData4::Exec, &VO_CTuple);
|
||||
VO_IntArr .IterElement(ZCShowData4::Exec, &VO_CTuple); VO_CTuple._1=1 ;
|
||||
VO_IntArr .IterElement(ZCShowData5::Exec, ZNsMain::ZtCRef<int>(VO_CTuple._1));
|
||||
VO_IntList.IterElement(ZCShowData5::Exec, ZNsMain::ZtCRef<int>(VO_CTuple._1));
|
||||
|
||||
cout<< "# Press Any Key to exit" << endl; cin.get();
|
||||
|
||||
|
Reference in New Issue
Block a user