edit test.cpp
This commit is contained in:
@ -721,10 +721,11 @@ namespace ZNsMain
|
|||||||
namespace ZNsEnum*/
|
namespace ZNsEnum*/
|
||||||
|
|
||||||
|
|
||||||
template<typename TTypeChar, typename TTypeLength> int GetCompareCode(
|
template<typename TTypeChar, typename TTypeLength> ZTypIntE GetCompareCode
|
||||||
|
(
|
||||||
const TTypeChar* ApcLeft , TTypeLength AI_LeftLength ,
|
const TTypeChar* ApcLeft , TTypeLength AI_LeftLength ,
|
||||||
const TTypeChar* ApcRight, TTypeLength AI_RightLength
|
const TTypeChar* ApcRight, TTypeLength AI_RightLength
|
||||||
) /*################################################################*/
|
) /*####################################################################*/
|
||||||
{
|
{
|
||||||
if(AI_LeftLength<1 && AI_RightLength<1) return ZNsEnum::ZECompareResult_Equal;
|
if(AI_LeftLength<1 && AI_RightLength<1) return ZNsEnum::ZECompareResult_Equal;
|
||||||
|
|
||||||
@ -743,10 +744,11 @@ namespace ZNsMain
|
|||||||
|
|
||||||
return ZNsEnum::ZECompareResult_Equal;
|
return ZNsEnum::ZECompareResult_Equal;
|
||||||
}/*
|
}/*
|
||||||
template<typename TTypeChar, typename TTypeLength> int GetCompareCode(
|
template<typename TTypeChar, typename TTypeLength> ZTypIntE GetCompareCode
|
||||||
|
(
|
||||||
const TTypeChar* ApcLeft , TTypeLength AI_LeftLength,
|
const TTypeChar* ApcLeft , TTypeLength AI_LeftLength,
|
||||||
const TTypeChar* ApcRight, TTypeLength AI_RightLength
|
const TTypeChar* ApcRight, TTypeLength AI_RightLength
|
||||||
) ##################################################################*/
|
) ######################################################################*/
|
||||||
|
|
||||||
|
|
||||||
namespace ZNsType
|
namespace ZNsType
|
||||||
@ -975,6 +977,59 @@ namespace ZNsMain
|
|||||||
namespace ZNsType*/
|
namespace ZNsType*/
|
||||||
|
|
||||||
|
|
||||||
|
/* 어떤 변수를 강제적으로 참조로 인식하게 하는 클래스. 인수를 참조로
|
||||||
|
넘어가게 하고 싶을 때 사용한다. class ZtCCheckRef 에서 사용하고 있다.
|
||||||
|
-- 2021-04-10 16:15
|
||||||
|
*/
|
||||||
|
template<typename TType> class ZtCRef
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef TType& TypeData;
|
||||||
|
typedef TType TypeRaw ;
|
||||||
|
private:
|
||||||
|
TypeData mr_Data;
|
||||||
|
public :
|
||||||
|
ZtCRef(TypeData AR_TypeData) : mr_Data(AR_TypeData){}
|
||||||
|
public :
|
||||||
|
TypeData GetData(){return mr_Data;}
|
||||||
|
};/*
|
||||||
|
template<typename TType> class ZtCRef*/
|
||||||
|
|
||||||
|
|
||||||
|
/* template 인수에 ZtCRef 가 있으면, 해당 값을 참조로 인식하고
|
||||||
|
그렇지 않으면, 일반적인 복사해서 전달되는 값으로 인식한다.
|
||||||
|
-- 2021-04-10 16:15
|
||||||
|
*/
|
||||||
|
template<typename TType> class ZtCCheckRef
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef TType TypeData ;
|
||||||
|
typedef TType TypeRaw ;
|
||||||
|
private:
|
||||||
|
TypeData mr_Data;
|
||||||
|
public :
|
||||||
|
ZtCCheckRef(TypeData AR_TypeData) : mr_Data(AR_TypeData){}
|
||||||
|
public :
|
||||||
|
TypeData GetData(){return mr_Data;}
|
||||||
|
};/*
|
||||||
|
template<typename TType> class ZtCCheckRef*/
|
||||||
|
|
||||||
|
/* ZtCRef 전문화 */
|
||||||
|
template<typename TType> class ZtCCheckRef< ZtCRef<TType> >
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef TType& TypeData;
|
||||||
|
typedef TType TypeRaw ;
|
||||||
|
private:
|
||||||
|
TypeData mr_Data;
|
||||||
|
public :
|
||||||
|
ZtCCheckRef(TypeData AR_TypeData) : mr_Data(AR_TypeData){}
|
||||||
|
public :
|
||||||
|
TypeData GetData(){return mr_Data;}
|
||||||
|
};/*
|
||||||
|
template<typename TType> class ZtCCheckRef< ZtCRef<TType> >*/
|
||||||
|
|
||||||
|
|
||||||
template<typename TClassExec> class ZtCArguBind
|
template<typename TClassExec> class ZtCArguBind
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -85,6 +85,15 @@ int main(int ArgiCnt, char** AppArgu)
|
|||||||
HereInt2 myi2= &myi1;
|
HereInt2 myi2= &myi1;
|
||||||
HereInt3 myi3= myi1 ; myi3=123;
|
HereInt3 myi3= myi1 ; myi3=123;
|
||||||
|
|
||||||
|
ZtCRef<int> myref(myi1);
|
||||||
|
ZtCCheckRef< int > myrefcheck1(myi1); myrefcheck1.GetData();
|
||||||
|
ZtCCheckRef< ZtCRef<int> > myrefcheck2(myi1); myrefcheck2.GetData();
|
||||||
|
|
||||||
|
myi1=4321;
|
||||||
|
|
||||||
|
cout<<"# myrefcheck1.GetData()="<<myrefcheck1.GetData()<<endl;
|
||||||
|
cout<<"# myrefcheck2.GetData()="<<myrefcheck2.GetData()<<endl;
|
||||||
|
|
||||||
cout<<"# HereInt1 ="<< typeid(myi1).name()<<endl;
|
cout<<"# HereInt1 ="<< typeid(myi1).name()<<endl;
|
||||||
cout<<"# HereInt2 int* ="<< typeid(myi2).name()<<endl;
|
cout<<"# HereInt2 int* ="<< typeid(myi2).name()<<endl;
|
||||||
cout<<"# HereInt3 int& ="<< typeid(myi3).name()<<endl;
|
cout<<"# HereInt3 int& ="<< typeid(myi3).name()<<endl;
|
||||||
|
Reference in New Issue
Block a user