I have an enumerated type, StackID, and I am using the enumeration to refer to an index of a particular vector and it makes my code easier to read.
However, I now have the need to create a variable called nextAvail of type StackID (it actually refers to a particular stackID ). I tried to increment it, but in C++ the following is illegal:
nextAvail++;
Which sort of makes sense to me … because there isn’t any bounds checking.
I’m probably overlooking something obvious, but what’s a good substitute?
I also want to link to this question.
Overloading
operator++: