惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
F
Full Disclosure
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
NISL@THU
NISL@THU
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
Latest news
Latest news
C
CERT Recently Published Vulnerability Notes
P
Privacy & Cybersecurity Law Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
CXSECURITY Database RSS Feed - CXSecurity.com
AWS News Blog
AWS News Blog
C
Cybersecurity and Infrastructure Security Agency CISA
L
Lohrmann on Cybersecurity
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
Tor Project blog
A
About on SuperTechFans
博客园 - 司徒正美
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
Blog — PlanetScale
Blog — PlanetScale
罗磊的独立博客
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LINUX DO - 热门话题
Know Your Adversary
Know Your Adversary
T
Tenable Blog
K
Kaspersky official blog
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
Cisco Talos Blog
Cisco Talos Blog
U
Unit 42
T
The Blog of Author Tim Ferriss
T
Threatpost
D
DataBreaches.Net
Engineering at Meta
Engineering at Meta
P
Palo Alto Networks Blog

博客园 - cosophy

ActiveX控件cab打包、Web嵌入、自动升级攻略 enable all verbs to application hosting on IIS 7.5 and using Asp.net 4.0 如何正确使用异常 ArcGIS 10 FlickrOnMap - A Silverlight Application Developed by Flickr Web API and ArcGIS Server API for Silverlight 关于Arcgis Server REST服务无法使用: Cannot acces http://localhost/arcgis/rest/services - cosophy Installing ArcGIS 9.3 On Microsoft Windows 7 SQL Server 2005 Express混合模式登录设置 List of REST Resources Enable SSL On IIS 7.0 Using Self-Signed Certificates 缅怀遥感地学之父、三院院士陈述彭先生 RSS Disabled: IE 7.0 could not read the RSS Feeds in the Feed List 关于地图投影与坐标系统 WCF:Configure svc MIME type on Vista IIS 7.0 ArcGIS Desktop 9.3 安装、破解 NSDTF-DEM格式数据 [ERR0134] Requested Service is not available 的解决方法 ERDAS 9.1 破解文件下载 修改ASP.NET成员提供程序,配置简单密码规则创建用户
C++单例模式
cosophy · 2012-04-23 · via 博客园 - cosophy

#ifndef _SINGLETON_H_ #define _SINGLETON_H_

//单件类

#include <memory>

using namespace std;

template <class T> class Singleton {

public:  static T* Instance()  {   if( 0 == _instance.get())   {    _instance.reset( new T);   }   return _instance.get();  }

private:  Singleton(void){}  /*  ~Singleton(void){};  Singleton(const Singleton&){};  Singleton & operator= (const Singleton &){};*/

 static auto_ptr<T> _instance; };

template <class T> auto_ptr<T> Singleton<T>::_instance;

//实现类T必须调用以下宏

#define DECLARE_SINGLETON_CLASS(type)\ friend class auto_ptr<type>;\ friend class Singleton<type>;

#endif

 REFENCENCE: http://blog.csdn.net/liuxialong/article/details/6764688