On Tue, 18 Nov 2025 at 11:38, Peter Dimov <pdimov@gmail.com> wrote:
Ruben Perez wrote:
On Tue, 18 Nov 2025 at 11:15, Peter Dimov via Boost < boost@lists.boost.org <mailto:boost@lists.boost.org> > wrote:
Ruben Perez wrote: > * Do you think the approach shown above is sound? In particular, > operators are in the global namespace so that they work with any enum > in any namespace correctly annotated.
No, I don't think this works. The operators have to be in the enum namespace.
Why? Is it because else there wouldn't be any way for the user to opt out from the default operator== definition? I understand that's the case for Describe, but users are explicitly opting into operators with the annotation. Or is there anything else I'm missing?
I see now. Thanks. Then the user would need a bunch of using bitmasks::operatorXY; statements in their namespace. This could be made slightly less verbose with a macro, but then I don't see much value in this reflection approach (against Andrey's macro suggestion, for instance).