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
a
Your code
enum Test { A, B } int a = 1;
Solution
Test castEnum = static_cast(a);