Boost logo

Boost :

From: tobi_at_[hidden]
Date: 2024-03-23 23:22:22


Am 2024-03-23 15:07, schrieb Дмитрий Архипов via Boost:
> сб, 23 мар. 2024 г. в 15:52, Tobias Loew via Boost
> <boost_at_[hidden]>:
>>
>> Hi,
>>
>> I would like to gauge interest in a library that makes the usage of
>> flag-like enumerations safer.
>> The library is called Boost.Flags, and its key features are
>> ...
>> Example on Godbolt: https://godbolt.org/z/qbojncnd7
>
> From the reading of the docs I gathered that the library relies on
> operators in the global namespace, rather than using a macro to define
> operators in an enum's namespace. This has a certain flaw:
> https://godbolt.org/z/xePjK3es6

The described flaw can be avoided by either including flags.hpp before
`foobar` or by `using ::operator |` in the enums namespace.
(https://godbolt.org/z/rT5678n4f)

I could add a macro the enables ADL for the current namespace, e.g.

#define BOOST_FLAGS_ENABLE_ADL_FOR_NS \
using ::operator| \
using ::operator& \
using ::operator^ \
... and so on


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk