How do I cast an int to an enum in C++?
For example:
enum Test { A, B }; int a = 1;
How do I convert a to type Test::A?
a
Test::A
int i = 1; Test val = static_cast<Test>(i);
1.4m articles
1.4m replys
5 comments
57.0k users