"no 'operator++(int)' declared for postfix '++' [-fpermissive]" on enums

Viewed 17927

I have got the enum

enum ProgramID
{
    A = 0,
    B = 1,
    C = 2,
    MIN_PROGRAM_ID = A,
    MAX_PROGRAM_ID = C,

} CurrentProgram;

Now, I am trying to increment CurrentProgram like this: CurrentProgram++, but the compiler complains: no 'operator++(int)' declared for postfix '++' [-fpermissive]. I think there IS such an operator that increments "enums", but if there is not, how do I get the successor of one of these values?

2 Answers
Related