From: Ivan Matek (libbooze_at_[hidden])
Date: 2025-06-11 10:15:42


On Wed, Jun 11, 2025 at 1:34 AM Andrey Semashev via Boost <
boost_at_[hidden]> wrote:

> Hi,
>
> There were quite a few times when I wanted to use bitwise operations on
> atomic<enum>, where the enum lists a number of flags that could be
> combined with bitwise AND, OR and XOR.
>

May I ask a bit more about motivation?
More precisely why you prefer this over just using unsigned integers for
flag?
If you are worried about uniqueness of set bit it can be checked at compile
time, e.g. something like this:
https://godbolt.org/z/xqG866M8h
(did not properly test this, so it may have bugs, but this is the idea).

I like "scope" for flags(e,g, Color in Color::Red) but that can be done
with namespaces, i.e. namespace Color{ constexpr uint32_t Red ... ,