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);
2.1m questions
2.1m answers
60 comments
57.0k users