【发布时间】:2020-05-08 06:21:18
【问题描述】:
我想在 for 循环中获取枚举值,方法是附加一个数字,例如
enum example
{
Example_1,
Example_2,
Example_3,
.
.
.
Example_n
};
example x;
for (i = 0; i < n; i++
{x = Example_ + i; // if i = 5, I need Example_5
}
我想要 C++11 中的这个实现
【问题讨论】:
-
不要使用枚举,使用数组。
-
你问的是C还是C++?
-
我已经有了在我的代码库中广泛使用的枚举。所以不能改成数组。
-
我要求 c++ 实现
标签: c++ c++11 enums enumeration