Compare commits
2 Commits
004c9a9135
...
5440691151
Author | SHA1 | Date | |
---|---|---|---|
/* User with id == 0 is a fake user from git author */
|
5440691151 | ||
/* User with id == 0 is a fake user from git author */
|
bf89d8c83e |
@ -660,7 +660,7 @@ namespace ZNsMain
|
||||
|
||||
|
||||
typedef class ZCIterEasy{} IterEasy, *IterEasyID ;
|
||||
typedef const IterEasyID* IterEasyIDc;
|
||||
typedef const IterEasyID IterEasyIDc;
|
||||
|
||||
/*///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -3959,12 +3959,12 @@ namespace ZNsMain
|
||||
//////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template
|
||||
<typename TType, typename TTypeArg=const TType&>
|
||||
<typename TType, typename TTypArgu=const TType&>
|
||||
class ZtCObjPtr
|
||||
{
|
||||
public :
|
||||
typedef TType TypeData ;
|
||||
typedef TTypeArg TypeArg ;
|
||||
typedef TTypArgu TypeArg ;
|
||||
protected:
|
||||
TypeData& mr_TypeData;
|
||||
public :
|
||||
@ -3983,11 +3983,11 @@ namespace ZNsMain
|
||||
}/*
|
||||
ZtCObjPtr& operator=(const ZtCObjPtr& rhs)*/
|
||||
|
||||
ZtCObjPtr& operator=(TTypeArg AO_ArguData)
|
||||
ZtCObjPtr& operator=(TTypArgu AO_ArguData)
|
||||
{
|
||||
mr_TypeData = AO_ArguData; return *this;
|
||||
}/*
|
||||
ZtCObjPtr& operator=(TTypeArg AO_ArguData)*/
|
||||
ZtCObjPtr& operator=(TTypArgu AO_ArguData)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
@ -4732,21 +4732,24 @@ namespace ZNsMain
|
||||
template ///////////////////////////////////////////////
|
||||
<
|
||||
typename TType ,
|
||||
typename TTypeArg = const TType&,
|
||||
typename TTypArgu = const TType&,
|
||||
typename TTypCAlloc = ZCAllocator ,
|
||||
typename TTypSize = ZTypLong
|
||||
typename TTypSize = ZTypLong ,
|
||||
typename TMoveObj = ZNsMain::
|
||||
ZtCMoveObj<TType, TTypArgu, true>
|
||||
>
|
||||
class ZtCList /*######################################*/
|
||||
{
|
||||
public:
|
||||
class ZCLink;
|
||||
public:
|
||||
typedef TType TypeData;
|
||||
typedef TTypeArg TypeArg ;
|
||||
typedef TTypCAlloc TypeAlloc;
|
||||
typedef TTypSize TypeSize;
|
||||
typedef ZCLink* IterEasy; // 가장 대표적으로 쓰일 수 있는 반복자.
|
||||
typedef ZCLink* iterator;
|
||||
typedef TType TypeData ;
|
||||
typedef TTypArgu TypeArg ;
|
||||
typedef TTypCAlloc TypeAlloc ;
|
||||
typedef TTypSize TypeSize ;
|
||||
typedef TMoveObj TypeMoveObj ;
|
||||
typedef ZCLink* IterEasy ; // 가장 대표적으로 쓰일 수 있는 반복자.
|
||||
typedef ZCLink* iterator ;
|
||||
public:
|
||||
|
||||
|
||||
@ -4932,15 +4935,45 @@ namespace ZNsMain
|
||||
void DeleteAll()*/
|
||||
|
||||
|
||||
TypeData& AddHead( /*++++++++++++*/ )
|
||||
{ return AddHeadLink(new ZCLink )->mo_Data; }
|
||||
TypeData& AddHead(TypeArg AO_ArgData)
|
||||
{ return AddHeadLink(new ZCLink(AO_ArgData))->mo_Data; }
|
||||
TypeData& AddHead()
|
||||
{ return AddHeadLink(new ZCLink)->mo_Data; }
|
||||
TypeData& AddTail()
|
||||
{ return AddTailLink(new ZCLink)->mo_Data; }
|
||||
|
||||
TypeData& AddTail( /*++++++++++++*/ )
|
||||
{ return AddTailLink(new ZCLink )->mo_Data; }
|
||||
TypeData& AddTail(TypeArg AO_ArgData)
|
||||
{ return AddTailLink(new ZCLink(AO_ArgData))->mo_Data; }
|
||||
|
||||
TypeData& AddHead(TypeArg AO_ArgData) /*########################*/
|
||||
{
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
{
|
||||
ZCLink* VP_NewNode = new ZCLink(AO_ArgData);
|
||||
|
||||
TypeMoveObj::Exec(VP_NewNode->mo_Data, AO_ArgData);
|
||||
|
||||
return AddHeadLink(VP_NewNode)->mo_Data;
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
#endif
|
||||
return AddHeadLink(new ZCLink(AO_ArgData))->mo_Data;
|
||||
}/*
|
||||
TypeData& AddHead(TypeArg AO_ArgData) ##########################*/
|
||||
|
||||
TypeData& AddTail(TypeArg AO_ArgData) /*########################*/
|
||||
{
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
{
|
||||
ZCLink* VP_NewNode = new ZCLink(AO_ArgData);
|
||||
|
||||
TypeMoveObj::Exec(VP_NewNode->mo_Data, AO_ArgData);
|
||||
|
||||
return AddTailLink(VP_NewNode)->mo_Data;
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
#endif
|
||||
return AddTailLink(new ZCLink(AO_ArgData))->mo_Data;
|
||||
}/*
|
||||
TypeData& AddTail(TypeArg AO_ArgData) ##########################*/
|
||||
|
||||
|
||||
void DeleteHead()
|
||||
@ -5212,9 +5245,11 @@ namespace ZNsMain
|
||||
template ///////////////////////////////////////////////
|
||||
<
|
||||
typename TType ,
|
||||
typename TTypeArg = const TType&,
|
||||
typename TTypArgu = const TType&,
|
||||
typename TTypCAlloc = ZCAllocator ,
|
||||
typename TTypSize = ZTypLong
|
||||
typename TTypSize = ZTypLong ,
|
||||
typename TMoveObj = ZNsMain::
|
||||
ZtCMoveObj<TType, TTypArgu, true>
|
||||
>
|
||||
class ZtCList /*######################################*/
|
||||
|
||||
|
@ -16,20 +16,23 @@ namespace ZNsMain
|
||||
template /*#######################################*/
|
||||
<
|
||||
typename TType ,
|
||||
typename TTypCArg =const TType&,
|
||||
typename TTypArgu =const TType&,
|
||||
typename TTypCAlloc=ZCAllocator ,
|
||||
typename TTypCInit =ZCInit ,
|
||||
typename TTypSize =ZTypLong
|
||||
typename TTypSize =ZTypLong ,
|
||||
typename TMoveObj = ZNsMain::
|
||||
ZtCMoveObj<TType, TTypArgu, true>
|
||||
>
|
||||
class ZtCSimList /*###############################*/
|
||||
{
|
||||
public:
|
||||
typedef TType Type ;
|
||||
typedef TType TypeData ;
|
||||
typedef TTypCArg TypeArg ;
|
||||
typedef TTypCAlloc TypeAlloc;
|
||||
typedef TTypCInit TypeInit ;
|
||||
typedef TTypSize TypeSize ;
|
||||
typedef TType Type ;
|
||||
typedef TType TypeData ;
|
||||
typedef TTypArgu TypeArg ;
|
||||
typedef TTypCAlloc TypeAlloc ;
|
||||
typedef TTypCInit TypeInit ;
|
||||
typedef TTypSize TypeSize ;
|
||||
typedef TMoveObj TypeMoveObj;
|
||||
public:
|
||||
|
||||
|
||||
@ -1219,7 +1222,15 @@ namespace ZNsMain
|
||||
void AddHead(TypeArg AR_Type)
|
||||
{
|
||||
ZCLink* VP_AddLink = GetCLinkHeap().GetOneLink() ;
|
||||
VP_AddLink->mo_Type= AR_Type ;
|
||||
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
{
|
||||
TypeMoveObj::Exec(VP_AddLink->mo_Type, AR_Type);
|
||||
}
|
||||
else ///////////////////////////////////////////////
|
||||
#endif
|
||||
VP_AddLink->mo_Type= AR_Type ;
|
||||
|
||||
if(++ml_Size==1) // ml_Size==0
|
||||
{
|
||||
@ -1259,7 +1270,15 @@ namespace ZNsMain
|
||||
void AddTail(TypeArg AR_Type)
|
||||
{
|
||||
ZCLink* VP_AddLink = GetCLinkHeap().GetOneLink();
|
||||
VP_AddLink->mo_Type= AR_Type ;
|
||||
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
{
|
||||
TypeMoveObj::Exec(VP_AddLink->mo_Type, AR_Type);
|
||||
}
|
||||
else ///////////////////////////////////////////////
|
||||
#endif
|
||||
VP_AddLink->mo_Type= AR_Type ;
|
||||
|
||||
if(++ml_Size==1) // ml_Size==0
|
||||
{
|
||||
@ -2299,109 +2318,19 @@ namespace ZNsMain
|
||||
}/*
|
||||
const TType& ItD(const IterEasyID APPI_IterEasyID) const*/
|
||||
|
||||
/*
|
||||
public:*/
|
||||
public:
|
||||
};/*
|
||||
class ZtCSimList*/
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
/****************** end class ZtCSimList ******************/
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamSimList
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
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;}
|
||||
};
|
||||
|
||||
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace ZNsMain;
|
||||
|
||||
typedef ZtCSimList<int> CObjList;
|
||||
|
||||
CHelpObj VO_CHelpObj;
|
||||
CObjList VO_CObjList;
|
||||
|
||||
VO_CObjList.AddTail(10);
|
||||
VO_CObjList.AddTail(20);
|
||||
VO_CObjList.AddTail(30);
|
||||
VO_CObjList.AddTail(40);
|
||||
|
||||
cout<<endl<<"#### Show CSimList 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 );
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, const char* APP_ArgVal[]=0)*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamSimList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
template ###########################################
|
||||
<
|
||||
typename TType ,
|
||||
typename TTypArgu =const TType&,
|
||||
typename TTypCAlloc=ZCAllocator ,
|
||||
typename TTypCInit =ZCInit ,
|
||||
typename TTypSize =ZTypLong ,
|
||||
typename TMoveObj = ZNsMain::
|
||||
ZtCMoveObj<TType, TTypArgu, true>
|
||||
>
|
||||
class ZtCSimList #################################*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
248
ZCppMainTest/ZtCList_000.cpp
Normal file
248
ZCppMainTest/ZtCList_000.cpp
Normal file
@ -0,0 +1,248 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCList
|
||||
{
|
||||
public:
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
cout<<"* CHelpObj()"<<endl;
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class CHelpObj*/
|
||||
|
||||
|
||||
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;}
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
typedef ZtCStringBase<char> CStringBase ;
|
||||
typedef const CStringBase CCStringBase;
|
||||
|
||||
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
|
||||
|
||||
ZtCList<CStringBase&, CCStringBase&>
|
||||
ZtCList<CStringBase&, CCCStringBase&>
|
||||
|
||||
*/
|
||||
typedef ZtCList
|
||||
<CStringBase, CStringBase&> CStringList1 ;
|
||||
typedef ZtCList
|
||||
<CStringBase, CCStringBase&> CStringList2 ;
|
||||
|
||||
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)
|
||||
{
|
||||
cout<<"* Data : "<<AR_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)*/
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
CStringBase VO_CStringBase;
|
||||
CStringList1 VO_ListOfStr1 ;
|
||||
CStringList2 VO_ListOfStr2 ;
|
||||
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 1th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr1.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 2th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr2.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
typedef ZtCList<int> CIntList;
|
||||
|
||||
CHelpObj VO_CHelpObj;
|
||||
CIntList VO_CIntList;
|
||||
|
||||
VO_CIntList.AddTail(10);
|
||||
VO_CIntList.AddTail(20);
|
||||
VO_CIntList.AddTail(30);
|
||||
VO_CIntList.AddTail(40);
|
||||
|
||||
cout<<endl<<"#### Show CIntList Element ####"<<endl<<endl;
|
||||
|
||||
VO_CIntList.IterElement(StFunctor ::ShowElement);
|
||||
VO_CIntList.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_CIntList.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCList_000.exe ZtCList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCList_000_D.exe ZtCList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCList_000_mw.exe ZtCList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCList_000_mw_D.exe ZtCList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCList_000_mw.exe
|
||||
./ZtCList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCList_000.exe ZtCList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCList_000_D.exe ZtCList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCList_000.exe
|
||||
./ZtCList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
249
ZCppMainTest/ZtCSimList_000.cpp
Normal file
249
ZCppMainTest/ZtCSimList_000.cpp
Normal file
@ -0,0 +1,249 @@
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "ZCppMain/ZtCSimList.H"
|
||||
#include "ZCppMain/ZtCStringEx.H"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
using namespace ZNsMain ;
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
namespace ZNsExam
|
||||
{
|
||||
|
||||
template<typename TDummy=void*> class ZtCExamCSimList
|
||||
{
|
||||
public:
|
||||
|
||||
class CHelpObj
|
||||
{
|
||||
public:
|
||||
|
||||
CHelpObj()
|
||||
{
|
||||
cout<<"* CHelpObj()"<<endl;
|
||||
}
|
||||
|
||||
CHelpObj(const CHelpObj& rhs)
|
||||
{
|
||||
cout<<"* CHelpObj(const CHelpObj& rhs)"<<endl;
|
||||
}
|
||||
|
||||
public:
|
||||
};/*
|
||||
class CHelpObj*/
|
||||
|
||||
|
||||
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;}
|
||||
};
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
cout<<"* Data : "<<AR_Data<<endl;
|
||||
}/*
|
||||
static void ShowDataInNode(const CStringBase& AR_Data)*/
|
||||
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||
{
|
||||
CStringBase VO_CStringBase;
|
||||
CStringList1 VO_ListOfStr1 ;
|
||||
CStringList2 VO_ListOfStr2 ;
|
||||
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr1.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 1th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr1.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
cout<<endl;
|
||||
|
||||
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 10"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 20"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||
VO_ListOfStr2.AddTail(VO_CStringBase("data 04"));
|
||||
|
||||
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||
|
||||
cout<<"# 2th IterElement ####" <<endl;
|
||||
{
|
||||
VO_ListOfStr2.IterElement(&ShowDataInNode);
|
||||
}
|
||||
/*///////////////////////////////////*/
|
||||
|
||||
|
||||
typedef ZtCSimList<int> CIntList;
|
||||
|
||||
CHelpObj VO_CHelpObj;
|
||||
CIntList VO_CIntList;
|
||||
|
||||
VO_CIntList.AddTail(10);
|
||||
VO_CIntList.AddTail(20);
|
||||
VO_CIntList.AddTail(30);
|
||||
VO_CIntList.AddTail(40);
|
||||
|
||||
cout<<endl<<"#### Show CIntList Element ####"<<endl<<endl;
|
||||
|
||||
VO_CIntList.IterElement(StFunctor ::ShowElement);
|
||||
VO_CIntList.IterElement(StFunctor2::ShowElement, VO_CHelpObj );
|
||||
VO_CIntList.IterElement(StFunctor3::ShowElement, ZftMCR(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor4::ShowElement, ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor5::ShowElement, ZftMCP(VO_CHelpObj), ZftMCP(VO_CHelpObj) );
|
||||
VO_CIntList.IterElement(StFunctor6::ShowElement, ZftMCP(VO_CHelpObj), VO_CHelpObj );
|
||||
|
||||
return 0;
|
||||
}/*
|
||||
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
template<typename TDummy=void*> class ZtCExamCSimList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsExam*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||
{
|
||||
return ZNsMain::ZNsExam::
|
||||
|
||||
ZtCExamCSimList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||
}/*
|
||||
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||
|
||||
|
||||
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
■ cygwin 컴파일
|
||||
|
||||
// g++ -mno-cygwin -o ZtCSimList_000.exe ZtCSimList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||
// g++ -mno-cygwin -o ZtCSimList_000_D.exe ZtCSimList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||
|
||||
■ mingw 컴파일
|
||||
|
||||
g++.exe -o ZtCSimList_000_mw.exe ZtCSimList_000.cpp -I../ -lWs2_32
|
||||
g++.exe -o ZtCSimList_000_mw_D.exe ZtCSimList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||
|
||||
./ZtCSimList_000_mw.exe
|
||||
./ZtCSimList_000_mw_D.exe
|
||||
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# date
|
||||
Sun Aug 24 10:47:09 KST 2025
|
||||
|
||||
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||
# g++ --version
|
||||
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
■ Linux 컴파일
|
||||
|
||||
g++ -std=c++98 -o ZtCSimList_000.exe ZtCSimList_000.cpp -I../
|
||||
g++ -std=c++98 -o ZtCSimList_000_D.exe ZtCSimList_000.cpp -I../ -D_DEBUG
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||
Sun Aug 24 00:05:51 DST 2025
|
||||
|
||||
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||
NAME="Ubuntu"
|
||||
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||
ID=ubuntu
|
||||
ID_LIKE=debian
|
||||
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||
VERSION_ID="20.04"
|
||||
HOME_URL="https://www.ubuntu.com/"
|
||||
SUPPORT_URL="https://help.ubuntu.com/"
|
||||
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||
VERSION_CODENAME=focal
|
||||
UBUNTU_CODENAME=focal
|
||||
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||
CentOS Linux release 7.9.2009 (Core)
|
||||
|
||||
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
■ 실행
|
||||
|
||||
./ZtCSimList_000.exe
|
||||
./ZtCSimList_000_D.exe
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////*/
|
Reference in New Issue
Block a user