In the ABI-breaking versions of glibmm and gtkmm, we have recently changed the enums to be C++11 "enum class"s. This is generally a welcome improvement. - Their values are, for instance, Things::ONE, rather than THINGS_ONE. - Their values do not convert implicitly to other types such as int or bool, helping the compiler to find some programmer mistakes.
We are also gradually moving the enums inside classes when they are typically only used with that class. However, some of the C enums that we wrap are actually meant to be integer constants, so it seems that we cannot and should not use "enum class" for these. So I wonder what is the most "modern C++" way to do this while keeping the new-style syntax. Here are two possibilities: 1. Use old-style enums inside a class: class ResponseType { public: enum Enum { NONE = -1, REJECT = -2, ACCEPT = -3, ... }; }; But shouldn't we just avoid old-style enums completely? 2. Use constexpr int constants inside a class: class ResponseType { public: constexpr int NONE = -1; constexpr int REJECT = -2; constexpr int ACCEPT = -3; ... }; But shouldn't we use some kind of enum to group the values together? -- Murray Cumming murr...@murrayc.com www.murrayc.com _______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list