c++11 enum class用法
使用过的一个enum class的用法: enum class EModel : int { Model1, Model2, Model3, Other = 4, }; EModel SRiverGetTorqueModelType(const int typeCount) { switch (typeCount) { case 0: return EModel::Model1; break; case 1: return EModel::Model3; break; case 2: return EModel::Model2; break; default: return EModel::Model1; } } int typeCount = xxx; if (EModel::Model1 == SRiverGetTorqueModelType(typeCount)) { } 来源: https://www.cnblogs.com/butterflybay/p/11398241.html