赞
踩
C++容器静态初始化
.h文件
class MyClass
{
public:
MyClass();
~MyClass();
private:
typedef QMap<QString, QString> CustomMap;
static CustomMap custom_map;
public:
static CustomMap InitMap()
{
CustomMap custom_map;
return custom_map;
};
};
.cpp文件
MyClass::CustomMap MyClass::custom_map = MyClass::InitMap();
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。