commit 2025-09-14 00:13 edit a bit ZCppMain/ZtCObjList.H

This commit is contained in:
2025-09-14 00:13:07 +09:00
parent f05b82847e
commit 86e1668591

View File

@ -35,7 +35,8 @@ namespace ZNsMain
, typename TTypeInit = ZtCInit<TType>
, typename TTypSize = ZTypLong
, typename TMoveObj = ZtCMoveObj<TType, TTypArgu, true>
, typename TFeeeHeap = ZNsIFaceEx::ZtCFreeHeapCDL<>
, typename TFeeeHeap = ZNsIFaceEx::
ZtCFreeHeapCDL< ZNsConst::CI_ListKind_Double >
>
class ZtCObjList //////////////////////////////////////////////////////////////
{
@ -2227,7 +2228,8 @@ namespace ZNsMain
, typename TTypeInit = ZtCInit<TType>
, typename TTypSize = ZTypLong
, typename TMoveObj = ZtCMoveObj<TType, TTypArgu, true>
, typename TFeeeHeap = ZNsIFace::ZIFreeHeap
, typename TFeeeHeap = ZNsIFaceEx::
ZtCFreeHeapCDL< ZNsConst::CI_ListKind_Double >
>
class ZtCObjList ////////////////////////////////////////////////////////////*/
@ -2352,166 +2354,6 @@ namespace ZNsMain
/////////////////////////////////////////////////////////////////////////////*/
namespace ZNsExam
{
template<typename TDummy=void*> class ZtCExamObjList
{
public:
#ifndef _WIN
class CHelpObj
{
public:
CHelpObj()
{
}
CHelpObj(const CHelpObj& rhs)
{
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
}
public:
};
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 //!defined(_WIN)
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
{
using namespace std ;
using namespace ZNsMain;
typedef ZtCObjList<int> CObjList ;
typedef CObjList::IterEasy IterEasyL;
CObjList VO_CObjList;
VO_CObjList.AddTail(10);
VO_CObjList.AddTail(20);
VO_CObjList.AddTail(30);
VO_CObjList.AddTail(40);
IterEasyL VH_IterL = VO_CObjList.ItHEasy();
#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;}
};
#else //!defined(_WIN)
CHelpObj VO_CHelpObj; cout<<"VO_CHelpObj Ptr : "<<&VO_CHelpObj<<endl;
#endif //!defined(_WIN)
cout<<endl<<"#### Show CObjList Element ####"<<endl<<endl;
VO_CObjList.IterElement(StFunctor ::ShowElement);
VO_CObjList.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
VO_CObjList.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
VO_CObjList.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
VO_CObjList.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
VO_CObjList.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
/* 위 코드에서 ShowElement() 정의가 Main 함수 안에 있으면,
linux g++ 4.4.7 에서 컴파일 에러다. struct StFunctor1
등의 정의를 Main() 함수 바깥으로 빼면 된다.
*/
__for1(int, i, VO_CObjList.size())
{
cout<<i<<"th value="<<
VO_CObjList.ItD(VH_IterL)<<endl;
VO_CObjList.ItNext(VH_IterL); //////
}/*
__for1(int, i, VO_CObjList.size())*/
return 0;
}/*
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
public:
};/*
template<typename TDummy=void*> class ZtCExamObjList*/
}/*
namespace ZNsExam*/
namespace ZNsType
{