【发布时间】:2017-11-26 21:22:00
【问题描述】:
由于 c++ 底层类型的 c++ 枚举应该是 int。
但是有代码
enum class Properties{ first , second }
void tmp ( int i ) {}
tmp( Properties::first )
编译器抱怨 Properties::first 不是 int 而不是 Properties 类型。
我真的必须将其转换为 int 才能将枚举值传递给函数还是有解决方法?
感谢您的帮助。
【问题讨论】:
-
@GaryHoliday,这与这个问题无关