Re: [Interest] Flags: Non-intrusive, type-safe bitwise operators for enums

Dmitry Arkhipov via Boost <[email protected]>
Newsgroups gmane.comp.lib.boost.devel
Message-ID <6248756.lOV4Wx5bFT@stupidpad2>
В письме от вторник, 17 марта 2026 г. 08:36:05 MSK пользователь Julien Blanc via Boost написал:
> 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 had the same thoughts when I wrote my take on this (it's in the list of "Other flags-like implementations" in this proposed library's docs). So, naturally I agree. And yes, having a dedicated type makes usage much more ergonomic.

But on the other hand, a lot of people consider having a dedicated type for flags/bitmasks a completely unnecessary overhead. I think these 2 groups will not find an agreement.


_______________________________________________
Boost mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/HWZRHNORGFL4QZNEUSJN4P2NIYMBCYFU/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.