In this for loop, NomChef is an enum type, and I want to loop nomChefActuel to all the values of that type, but I get an "invalid conversion from 'int' to 'NomChef' when compiling... do I have to apply some sort if type casting there?
well, I have nomChefActuel <= NOMBRE_DE_CHEF as my condition to prevent that, also I make nomChefActuel to start at 1 cause I want to skip the first value...
If I did have to cast, do you know what kind I should use?
any ideas, anyone? (if not I'm gonna have to nest an if-else structure to associate an 'int' with all the elements of the enum... it's not that though, but I thought there would be an easier way out of it...) :-/
I do have a question though.... it says in the tutorial that enum types have numerical values associated with them... how come we can't use that?? Is it my compiler (code::blocks) ? Or is it something I don't understand ? Help please this is annoying I think it should work...
I do have a question though.... it says in the tutorial that enum types have numerical values associated with them... how come we can't use that?? Is it my compiler (code::blocks) ? Or is it something I don't understand ? Help please this is annoying I think it should work...
You can't use that because multiple enum values could have the same integral value associated with them and some integral values may have no enum value associated with them (e.g. gaps). Additionally, in C++11 enums are not always associated with integral values, so you cannot make that assumption.