diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index f001539..71d4f3c 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -1148,6 +1148,76 @@ namespace ZNsMain namespace ZNsType*/ + + /*////////////////////////////////////////////////////////////// + + ■ 가끔 템플릿으로 클래스 설계를 하다보면 템플릿의 parameter 가 + 포인터나 참조일 경우, 무엇의 포인터나 참조형인지 알고 싶을 때 + 가 있다. 이런 경우에 ZtCTypeData<> 를 사용한다. + + cf) + + cout<::TypeData).name()<::TypeData).name()<::TypeData).name()<::GetObjRef(~) 는 아래처럼 주로 포인터 자료형을 + (null 이 아닌 경우) 항상 참조형으로 다루고 싶을 때 사용한다. + 템플릿 Parameter 가 포인터형인데, 무엇의 포인터 형인지 알아 + 내어, 참조형으로 만들어 다른 함수의 인수로 사용하거나, 해당 + 멤버의 호출을 포인터 참조 표기 -> 말고 참조 표기(.)로 하면 편 + 할 것이다. + + typedef std::CStringBase_T CStringData ; + typedef CStringData* CStringDataPtr; + + CStringData VO_CStringData("My"); + CStringDataPtr VP_CStringData=&VO_CStringData; + + (*VP_CStringData)("Data"); + + cout<::GetObjRef(VP_CStringData)< class ZtCTypeData + { public: typedef TType TypeData; + static TType& GetObjRef(TType& AR_Type){return AR_Type ;}}; + template class ZtCTypeData + { public: typedef TType TypeData; + static TType& GetObjRef(TType* AP_Type){return *AP_Type;}}; + template class ZtCTypeData + { public: typedef TType TypeData; + static TType& GetObjRef(TType& AR_Type){return AR_Type ;}}; + template< /*########*/ > class ZtCTypeData + { public: typedef ZfpNone TypeData; + static ZfpNone GetObjRef(void* AP_Void){return ZfNone ;}}; + + template class ZtCTD + { public: typedef TType TypeData; + static TType& GetObjRef(TType& AR_Type){return AR_Type ;} + static TType& GOR (TType& AR_Type){return AR_Type ;}}; + template class ZtCTD + { public: typedef TType TypeData; + static TType& GetObjRef(TType* AP_Type){return *AP_Type;} + static TType& GOR (TType* AP_Type){return *AP_Type;}}; + template class ZtCTD + { public: typedef TType TypeData; + static TType& GetObjRef(TType& AR_Type){return AR_Type ;} + static TType& GOR (TType& AR_Type){return AR_Type ;}}; + template< /*########*/ > class ZtCTD + { public: typedef ZfpNone TypeData; + static ZfpNone GetObjRef(void* AP_Void){return ZfNone ;} + static ZfpNone GOR (void* AP_Void){return ZfNone ;}}; + + + /*////////////////////////////////////////////////////////////////////////////////////////// ■ template 인수가 Type11 까지 있음에 주의한다. 그러면 Type10 까지 전문화할 수 있는 것이다. @@ -1163,7 +1233,6 @@ namespace ZNsMain //////////////////////////////////////////////////////////////////////////////////////////*/ - template< typename Type1 , typename Type2 =void, typename Type3=void, typename Type4 =void, typename Type5=void, typename Type6 =void, @@ -2443,73 +2512,6 @@ namespace ZNsMain class ZCAllocClass : public ZCAllocator*/ - /*////////////////////////////////////////////////////////////// - - ■ 가끔 템플릿으로 클래스 설계를 하다보면 템플릿의 parameter 가 - 포인터나 참조일 경우, 무엇의 포인터나 참조형인지 알고 싶을 때 - 가 있다. 이런 경우에 ZtCTypeData<> 를 사용한다. - - cf) - - cout<::TypeData).name()<::TypeData).name()<::TypeData).name()<::GetObjRef(~) 는 아래처럼 주로 포인터 자료형을 - (null 이 아닌 경우) 항상 참조형으로 다루고 싶을 때 사용한다. - 템플릿 Parameter 가 포인터형인데, 무엇의 포인터 형인지 알아 - 내어, 참조형으로 만들어 다른 함수의 인수로 사용하거나, 해당 - 멤버의 호출을 포인터 참조 표기 -> 말고 참조 표기(.)로 하면 편 - 할 것이다. - - typedef std::CStringBase_T CStringData ; - typedef CStringData* CStringDataPtr; - - CStringData VO_CStringData("My"); - CStringDataPtr VP_CStringData=&VO_CStringData; - - (*VP_CStringData)("Data"); - - cout<::GetObjRef(VP_CStringData)< class ZtCTypeData - { public: typedef TType TypeData; - static TType& GetObjRef(TType& AR_Type){return AR_Type ;}}; - template class ZtCTypeData - { public: typedef TType TypeData; - static TType& GetObjRef(TType* AP_Type){return *AP_Type;}}; - template class ZtCTypeData - { public: typedef TType TypeData; - static TType& GetObjRef(TType& AR_Type){return AR_Type ;}}; - template< /*########*/ > class ZtCTypeData - { public: typedef ZfpNone TypeData; - static ZfpNone GetObjRef(void* AP_Void){return ZfNone ;}}; - - template class ZtCTD - { public: typedef TType TypeData; - static TType& GetObjRef(TType& AR_Type){return AR_Type ;} - static TType& GOR (TType& AR_Type){return AR_Type ;}}; - template class ZtCTD - { public: typedef TType TypeData; - static TType& GetObjRef(TType* AP_Type){return *AP_Type;} - static TType& GOR (TType* AP_Type){return *AP_Type;}}; - template class ZtCTD - { public: typedef TType TypeData; - static TType& GetObjRef(TType& AR_Type){return AR_Type ;} - static TType& GOR (TType& AR_Type){return AR_Type ;}}; - template< /*########*/ > class ZtCTD - { public: typedef ZfpNone TypeData; - static ZfpNone GetObjRef(void* AP_Void){return ZfNone ;} - static ZfpNone GOR (void* AP_Void){return ZfNone ;}}; - /*////////////////////////////////////////////////////////////////////////////////