Singleton
来源:互联网 发布:mac see sheer西柚色 编辑:程序博客网 时间:2024/05/01 13:36
// Default traits for Singleton<Type>. Calls operator new and operator delete on
// the object. Registers automatic deletion at process exit.
// Overload if you need arguments or another memory allocation function.
template<typename Type>
struct DefaultSingletonTraits {
// Allocates the object.
static Type* New() {
// The parenthesis is very important here; it forces POD type
// initialization.
return new Type();
}
// Destroys the object.
static void Delete(Type* x) {
delete x;
}
// Set to true to automatically register deletion of the object on process
// exit. See below for the required call that makes this happen.
static const bool kRegisterAtExit = true;
};
// Alternate traits for use with the Singleton<Type>. Identical to
// DefaultSingletonTraits except that the Singleton will not be cleaned up
// at exit.
template<typename Type>
struct LeakySingletonTraits : public DefaultSingletonTraits<Type> {
static const bool kRegisterAtExit = false;
};
- Singleton
- Singleton
- singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Singleton
- Webwork项目总结(三)
- Content Type type
- 在Sql中编写函数功能分隔字符串(同VB的split)
- 翟鸿燊语录
- Force "Save file" dialog on the JSP page
- Singleton
- 调试ingres源代码(一)
- 以Android为起点,博客开始更新。
- JS中集合操作
- C#常用日期格式处理转换
- 《Hacking Vim》读书笔记:Vim中高级技巧
- window.location
- asp.net中发送Mail的简单实例
- 配置Mondrian源码