我有以下枚举和地图:
typedef enum {
MaxX = 0,
MaxY,
MaxCells,
MaxCycles,
Threes
} SettingName;
typedef std::map<SettingName, const char*> SettingNameCollection;
SettingNameCollection settingNames;
我有以下函数来返回枚举名称:
const char* gofBoard::getSettingName(unsigned x) {
return settingNames[static_cast<SettingName>(x)];
}
从我读过的内容来看,这应该可以工作,但该函数不返回任何内容。没有编译时错误,也没有运行时错误。