code_junkie

Max and min values in a C++ enum

Nov 11th, 2011
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. enum MyPretendEnum
  2. {
  3. Apples,
  4. Oranges,
  5. Pears,
  6. Bananas,
  7. First = Apples,
  8. Last = Bananas
  9. };
  10.  
  11. enum Name
  12. {
  13. val0,
  14. val1,
  15. val2,
  16. num_values
  17. };
  18.  
  19. enum {
  20. eAaa = 1,
  21. eBbb,
  22. eCccc,
  23. eMin = eAaaa,
  24. eMax = eCccc
  25. }
  26.  
  27. enum My_enum
  28. {
  29. FIRST_VALUE = 0,
  30.  
  31. MY_VALUE1,
  32. MY_VALUE2,
  33. ...
  34. MY_VALUEN,
  35.  
  36. LAST_VALUE
  37. };
  38.  
  39. enum Name{val0,val1,val2};
  40.  
  41. if(selectedOption>=val0 && selectedOption<=val2){
Add Comment
Please, Sign In to add comment