How do I randomly select a value for an enum type in C++?
I would like to do something like this.
enum my_type(A,B,C,D,E,F,G,h,J,V);
my_type test(rand() % 10);
But this is illegal... there is not an implicit conversion from int to an enum type.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…