一个例子通常比长期解释更好. 您可以在Coliru上编译并运行此代码段. (另一个前例子也可用)
#include <map> #include <iostream> struct MyClass { enum class …
c++ string enums c++17 c++20
我只是注意到你不能在枚举上使用标准数学运算符,如++或+ =
那么迭代C++枚举中所有值的最佳方法是什么?
c++ enums
c++ ×2
enums ×2
c++17 ×1
c++20 ×1
string ×1