Referencing this question, I ask, what is the best way (as in general, least error prone approach) to iterate over all enum values in C++98?
Limitations of C++98:
- no enum classes
- no foreach loop
What should be avoided in the solution (I am pretty sure, not everything can be avoided):
- A) Macros masking standard language features (e.g.
#define CREATE_ENUM(...)
) - B) including other headers
- C) repetition of code
- D) adding enum elements only for iteration
- E) assumption on enum layout (e.g. always increments by 1, last element is always XXX)