...
Code Block | ||
---|---|---|
| ||
enum et1 { E_A, E_B }; int i1 = -1; if (i1 < 0 || i1 > E_CB) { /* error condition */ } et1 e1 = static_cast<et1>(i1); |
...
Code Block | ||
---|---|---|
| ||
enum et1 { E_A, E_B }; int i1 = 5; if (i1 < 0 || i1 > E_CB) { /* error condition */ } switch(static_cast<et1>(i1)) { case E_A: /* some action A */ case E_B: /* some action B */ } |
...