【发布时间】:2013-02-02 23:34:03
【问题描述】:
我有一个
struct OpDesc {
std::string OPName;
size_t OPArgsMin;
bool IsVaribaleArgsNum;
bool IsOPChange;
std::string ChangeNodeOP;
std::string ChangeNodeLabel;
bool IsOPDelete;
const char* ErrMsg;
};
并且想初始化一个std::map<string, OpDesc>。
我试过这样做:
typedef std::map<std::string,struct OpDesc> OpDescMap;
OpDescMap opDesc;
opDesc["StoreOp"] = {"StoreOp",2,false,false,"","",false,""};
/// etc.
我无法用 VS10 编译它。我得到:error C2059: syntax error : '{'
如何解决?
【问题讨论】:
标签: c++ map static struct init