commit 2025-08-24 01:33 add ZCppMainTest/ZtCArray_000.cpp
This commit is contained in:
@ -765,10 +765,10 @@ namespace ZNsMain
|
||||
{ return GetDataInIter((const Type*)ARRI_IterEasyID, AI_FarNum); }
|
||||
|
||||
|
||||
Type* ItHEasy (){return mp_TypeArr ;}
|
||||
Type* ItTEasy (){return mp_TypeArr+ml_UseSize-1 ;}
|
||||
IterEasyID ItHID(){return (IterEasyID) mp_TypeArr ;}
|
||||
IterEasyID ItTID(){return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
Type* ItHEasy(){return mp_TypeArr ;}
|
||||
Type* ItTEasy(){return mp_TypeArr+ml_UseSize-1 ;}
|
||||
IterEasyID ItHID (){return (IterEasyID) mp_TypeArr ;}
|
||||
IterEasyID ItTID (){return (IterEasyID)(mp_TypeArr+ml_UseSize-1);}
|
||||
|
||||
const Type* ItHEasy () const{return mp_TypeArr ;}
|
||||
const Type* ItTEasy () const{return mp_TypeArr+ml_UseSize-1 ;}
|
||||
@ -823,161 +823,6 @@ namespace ZNsMain
|
||||
///////////////////////////////////////////////
|
||||
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamArray
|
||||
{
|
||||
public:
|
||||
|
||||
#ifndef _WIN
|
||||
|
||||
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;}
|
||||
};
|
||||
|
||||
#endif //#ifndef _WIN
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
typedef ZtCArray<int> CArray ;
|
||||
typedef CArray::IterEasy IterEasy;
|
||||
|
||||
|
||||
CArray VO_Array;
|
||||
|
||||
VO_Array.AddTail(10);
|
||||
VO_Array.AddTail(20);
|
||||
VO_Array.AddTail(30);
|
||||
VO_Array.AddTail(40);
|
||||
|
||||
|
||||
#ifdef _WIN
|
||||
|
||||
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;}
|
||||
};
|
||||
|
||||
#endif //_WIN
|
||||
|
||||
VO_Array.IterElement(StFunctor ::ShowElement);
|
||||
VO_Array.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_Array.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_Array.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
|
||||
IterEasy VH_Iter = VO_Array.ItHEasy();
|
||||
|
||||
__for1(int, i, VO_Array.size())
|
||||
{
|
||||
cout<<i<<"th value="<<
|
||||
VO_Array.ItD(VH_Iter)<<endl;
|
||||
|
||||
VO_Array.ItNext(VH_Iter);
|
||||
}
|
||||
///////////////////////////////
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamArray*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Reference in New Issue
Block a user