#include <stdlib.h>
#include <memory.h>
#include <vector>
#include <string>
#include <iostream>
#include <windows.h>
using namespace std;
#pragma pack(push)
#pragma pack(1)
template <typename T>
class Singleton
{
};
class CMatchListMgr: public Singleton<CMatchListMgr>
{
};
int main( )
{
cout<<sizeof(CMatchListMgr)<<endl;
return 0;
}
本文展示了一个使用 C++ 实现的单例模式示例,并通过 `CMatchListMgr` 类展示了如何定义和使用单例类。该示例包括了必要的头文件引入、模板类定义以及主函数中对单例类大小的打印。
3544

被折叠的 条评论
为什么被折叠?



