Hello again everyone!
While working on a small project I decided to use C++'s enumeration type, which looks like this:
I've consulted a few documents briefly on using it within loops, and as far as I can see its only a pain in the neck. There are no attributes like Ada, and you can't just add one like you could in C. I want to do a loop like this:
However, the only way I've been able to get it to work is to have a switch to handle each case to update state for the next iteration or to break if need be, which is a huge pain in the neck. Should I scrap the enum data type for another or am I missing something?
Thanks. :)
While working on a small project I decided to use C++'s enumeration type, which looks like this:
enum EState { eSamsara, eMind, eBody, eSoul, eDamian, eNirvana };
I've consulted a few documents briefly on using it within loops, and as far as I can see its only a pain in the neck. There are no attributes like Ada, and you can't just add one like you could in C. I want to do a loop like this:
for ( EState state = eSamsara; state < eNirvana; state++ )
{
// code here
}
However, the only way I've been able to get it to work is to have a switch to handle each case to update state for the next iteration or to break if need be, which is a huge pain in the neck. Should I scrap the enum data type for another or am I missing something?
Thanks. :)