【发布时间】:2015-07-11 00:17:06
【问题描述】:
我有这样的(恒定的)数据:
(index) Width Height Scale Name
0 640 360 1 "SD"
1 1080 720 2 "HD"
2 1920 1080 3 "FHD"
到目前为止 - 我已经创建了这样的结构:
struct Resolution
{
int Width;
int Height;
int Scale;
std::string Name;
};
现在我需要一个可以让我执行以下操作的对象:
int index = 0;
int width = Resolutions[index].Width; // 360
我需要枚举或一些不变的数组,无需初始化即可访问(静态?)。
【问题讨论】:
-
我不明白,你在哪里需要枚举?
-
嗯...我想增加索引。我不确定我是否需要枚举。它可能是一些数组。