Почему я не могу увеличить переменную перечислимого типа?C++

Программы на C++. Форум разработчиков
Гость
Почему я не могу увеличить переменную перечислимого типа?

Сообщение Гость »


У меня есть перечислимый тип,, 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 (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.


Источник: https://stackoverflow.com/questions/347 ... rated-type

Вернуться в «C++»