On Tue, 17 Mar 2026 at 06:38, Julien Blanc via Boost <boost@lists.boost.org> wrote:
I've come to the conclusion that any representation of enum flags with C++ enums is a design mistake by itself (a pretty widespread one, but still a mistake). Enums are individual values, enum flags are a set of values, they are different by nature. In C++, different things deserve a different type, call it an enum_bitset, an enum_set or whatever, but donc make it a plain enum / enum class.
I totally agree. We’ve had this same discussion in November and I’ve made the same argument. Conceptually, enum values and sets of enum values should be different things. C code has always made the distinction between enums (`enum`) and enum sets (`unsigned int`). The only hurdles here are practical in nature. C++ technically treats any bit pattern of an enum type as a valid value, so you could argue there is no need for a second type. Furthermore, there is no standard “enum set” type, so you have to invent one yourself, which is kind of a big deal for something so fundamental, especially in public interfaces. -Janko