commit 2025-10-05 20:29 add ZCppMainTest/ZtCLinkList_000.cpp
This commit is contained in:
@ -4487,7 +4487,38 @@ namespace ZNsMain
|
||||
|
||||
public :
|
||||
};/*
|
||||
template<typename TType> class ZtCObjPtr */
|
||||
template
|
||||
<typename TType, typename TTypArgu=const TType&>
|
||||
class ZtCObjPtr
|
||||
*/
|
||||
|
||||
|
||||
template<typename TType> class ZtCObjOpt // C++ 17 에 추가된 optional 구현
|
||||
{
|
||||
public :
|
||||
typedef TType TypeData;
|
||||
protected:
|
||||
TypeData* mp_TypeData ;
|
||||
public :
|
||||
|
||||
ZtCObjOpt(TypeData& AR_CData) : mp_TypeData(&AR_CData ){}
|
||||
ZtCObjOpt(TypeData* AP_CData) : mp_TypeData( AP_CData ){}
|
||||
ZtCObjOpt(ZtCObjOpt& AR_Rhs ) : mp_TypeData(AR_Rhs.mp_TypeData){}
|
||||
|
||||
TypeData* operator->(){return mp_TypeData;}
|
||||
TypeData& operator* (){return *mp_TypeData;}
|
||||
operator TypeData& (){return *mp_TypeData;}
|
||||
|
||||
ZtCObjOpt& operator=(const ZtCObjOpt& rhs)
|
||||
{ mp_TypeData=rhs.mp_TypeData; return *this; }
|
||||
|
||||
bool has_value() const{return mp_TypeData!=0;}
|
||||
|
||||
TypeData& value() const{return *mp_TypeData ;}
|
||||
|
||||
public :
|
||||
};/*
|
||||
template<typename TType> class ZtCObjOpt */
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user