converting from int to enum

Started by
3 comments, last by randomDecay 22 years, 5 months ago
I have a struct with an enum member and this handles my colors. What I want to do is ask the user to enter a color, preferably 0 for white, 1 for red..etc.. How would I convert this int to an enum? Any easier way to do this beside typecasting?
Advertisement
Why don''t you want to just cast it ?
eColor = static_cast(nUserColor);
Sorry ...

eColor = static_cast(nUserColor);
I guess AP is trying to say
eColor = static_cast<enumColor>(nUserColor);

-Neophyte

- Death awaits you all with nasty, big, pointy teeth. -
Or even:

eColor = (enumColor)nUserColor;

for the brave and bold knights of old among us...

---------------

I finally got it all together...
...and then forgot where I put it.

This topic is closed to new replies.

Advertisement