CrossFramework Library
|
00001 00006 #if defined(XBASE_INCLUDED_PODCLASS_HPP) 00007 #else 00008 #define XBASE_INCLUDED_PODCLASS_HPP 00009 00010 //------------------------------------------------------------ 00011 #include <XBase/PODStruct.hpp> 00012 #include <XBase/StaticAssert.hpp> 00013 #include <XBase/TypeTraits.hpp> 00014 00015 //------------------------------------------------------------ 00016 namespace XBase { 00018 00019 00024 template< typename T > 00025 class PODClass : public PODStruct<T> 00026 { 00027 public: 00029 typedef ::XBase::PODStruct<T> StructType; 00030 00031 PODClass() { StructType::ref() = StructType::DefaultValue(); } 00032 PODClass( const PODStruct<T>& aValue ) { StructType::ref() = aValue; } 00033 00034 private: 00035 typedef StructType SuperClass; 00036 XBASE_STATIC_ASSERT( TypeTraits::IsPOD< StructType >::Value ); 00037 XBASE_STATIC_ASSERT( sizeof(SuperClass) == sizeof( ValueType ) ); // サイズが同じであることを保証。 00038 }; 00040 } 00041 //------------------------------------------------------------ 00042 #endif 00043 // EOF