commit 2025-09-11 14:31 edit a bit ZCppMain/ZtCArray.H
This commit is contained in:
@ -429,110 +429,6 @@ namespace ZNsMain
|
|||||||
template<typename TFunctor, typename TTypeHelp>
|
template<typename TFunctor, typename TTypeHelp>
|
||||||
void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp)
|
void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp)
|
||||||
{
|
{
|
||||||
/*/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
■ TTypeHelp 가 class 일 경우, 크기가 커서 참조로 넘어가야 한다면,
|
|
||||||
|
|
||||||
IterElement<myFunctor, myClass&>(myFunctor_obj, myClass_Obj);
|
|
||||||
|
|
||||||
의 형태로 호출할 게 아니라, ZNsMain::ZtCObjectPtr<> 을 사용하여,
|
|
||||||
|
|
||||||
myClass myClass_Obj;
|
|
||||||
|
|
||||||
ZNsMain::ZtCObjectPtr<myClass> myCObjPtr(myClass_Obj);
|
|
||||||
|
|
||||||
나
|
|
||||||
|
|
||||||
IterElement(myFunctor_obj,
|
|
||||||
ZNsMain::ZtCObjectPtr<myClass>(myClass_Obj));
|
|
||||||
|
|
||||||
형태를 사용하면 좋을 것 같다. -- 2014-06-16 23:11:00
|
|
||||||
|
|
||||||
|
|
||||||
ZCCheckRef::PassData() 으로 인해, 인수를 ZtCRef 클래스를 이용해 인수를 참조
|
|
||||||
로 넘길 수 있게 되었다. -- 2021-03-10 16:56
|
|
||||||
|
|
||||||
이제는 ZtCRef 과 ZCCheckRef 클래스 템플릿을 사용하면 된다. -- 2021-03-11 11:00
|
|
||||||
|
|
||||||
이제는 ZftMCR() 과 ZftMCP() 을 사용하면 된다. -- 2025-08-07 17:55
|
|
||||||
|
|
||||||
■ 예제1 -- 2025-08-07 17:35
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "ZCppMain/ZtCArray.H"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std ;
|
|
||||||
using namespace ZNsMain;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
ZtCArray<int> myArray;
|
|
||||||
|
|
||||||
myArray.AddTail(10);
|
|
||||||
myArray.AddTail(20);
|
|
||||||
myArray.AddTail(30);
|
|
||||||
myArray.AddTail(40);
|
|
||||||
|
|
||||||
class CHelpObj
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
CHelpObj()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CHelpObj(const CHelpObj& rhs)
|
|
||||||
{
|
|
||||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
}; CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
|
|
||||||
|
|
||||||
struct StFunctor
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue){cout<<"#1 Value="<<ArgiValue<<endl;}
|
|
||||||
};
|
|
||||||
struct StFunctor2
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue, CHelpObj)
|
|
||||||
{cout<<"#2 Value="<<ArgiValue<<", CHelpObj Addr=None"<<" With CHelpObj"<<endl;}
|
|
||||||
};
|
|
||||||
struct StFunctor3
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
|
||||||
{cout<<"#3 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref"<<endl;}
|
|
||||||
};
|
|
||||||
struct StFunctor4
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj)
|
|
||||||
{cout<<"#4 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj in Ptr"<<endl;}
|
|
||||||
};
|
|
||||||
struct StFunctor5
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj& AR_CHelpObj2)
|
|
||||||
{cout<<"#5 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Ref 2"<<endl;}
|
|
||||||
};
|
|
||||||
struct StFunctor6
|
|
||||||
{
|
|
||||||
static void ShowElement(int ArgiValue, CHelpObj& AR_CHelpObj, CHelpObj AO_CHelpObj2)
|
|
||||||
{cout<<"#6 Value="<<ArgiValue<<", HelpObj Ptr="<<&AR_CHelpObj<<" With CHelpObj Half Ref"<<endl;}
|
|
||||||
};
|
|
||||||
|
|
||||||
myArray.IterElement(StFunctor ::ShowElement);
|
|
||||||
myArray.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
|
||||||
myArray.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
|
||||||
myArray.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
|
||||||
myArray.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
|
||||||
myArray.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
typedef ZNsMain::
|
typedef ZNsMain::
|
||||||
ZtCCheckRef<TTypeHelp> ZCCheckRef;
|
ZtCCheckRef<TTypeHelp> ZCCheckRef;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user