Consider:
enum Test { a = 3, b = 7, c = 1 };
I want to access the enum using an index. Something like this:
for
This is the best you can do:
enum Test { a = 3, b = 7, c = 1, LAST = -1 }; static const enum Test Test_map[] = { a, b, c, LAST }; for (int i = 0; Test_map[i] != LAST; i++) doSomething(Test_map[i]);
You have to maintain the mapping yourself.