2012年10月16日
摘要: #include <cassert>template <typename T> class Singleton{ static T* ms_Singleton;public: Singleton( void ) { assert( !ms_Singleton ); int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1; ms_Singleton = (T*)((int)this + offset); } ~Singleton( void ) { assert( ms_Singleton ); ms_Sing 阅读全文
posted @ 2012-10-16 11:14 jackdesk 阅读(142) 评论(0) 推荐(0) 编辑