
On 12 Jun 2025 11:24, Alexander Grund via Boost wrote:
As for atomic enums: I wouldn't expect too much there as e.g. `config |= ConfigEnum::UseSimd` wouldn't be reliable for atomics without a compare&swap.
There are atomic instructions that implement bitwise operations directly, without a CAS loop. Including on x86, although not in all cases.
You noted that already for "user-defined bitwise operators defined for an enum,", so I guess you are aware of that already.
To be clear, I'm not suggesting that e.g. atomic<enum>::fetch_or() should be calling the user-defined operator| for the enum. *That* would require a CAS loop. No, I'm suggesting that atomic bitwise operations should be defined in terms of value representations, pretty much how compare_exchange_(weak|strong) is defined, which, as you know, compares values "as if with memcmp" and does not invoke any user-defined operator==().