CrossFramework Library
|
00001 00006 #if defined(XBASE_INCLUDED_PODINHERITCLASS_HPP) 00007 #else 00008 #define XBASE_INCLUDED_PODINHERITCLASS_HPP 00009 00010 //------------------------------------------------------------ 00011 #include <XBase/StaticAssert.hpp> 00012 #include <XBase/TypeTraits.hpp> 00013 00014 //------------------------------------------------------------ 00015 namespace XBase { 00017 00018 00022 template< typename POD_TYPE > 00023 class PODInheritClass : public POD_TYPE 00024 { 00025 public: 00027 typedef POD_TYPE PODType; 00028 00030 PODInheritClass() 00031 { 00032 PODType obj = {}; 00033 static_cast< PODType& >( *this ) = obj; 00034 } 00035 00037 PODInheritClass( const PODType& aObj ) 00038 : PODType( aObj ) 00039 { 00040 } 00041 00042 private: 00043 XBASE_STATIC_ASSERT( TypeTraits::IsPOD< PODType >::Value ); 00044 }; 00045 00047 } 00048 //------------------------------------------------------------ 00049 #endif 00050 // EOF