Boost logo

Boost :

Subject: Re: [boost] interest in a flag library
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2018-10-26 08:08:03


> On 26. Oct 2018, at 09:35, Andrzej Krzemienski via Boost <boost_at_[hidden]> wrote:
>
> Hi. I would use a type-safe library for flags. I am missing one today.
[…]
> I would rather expect an interface using named functions or indexing
> operator:
>
> ```
> if (!flags[Flag::READ])
> flags.reset(Flag::EXEC);
> ```

There are std::bitset (fixed size, allocates on the stack) and boost::dynamic_bitset (dynamic size, allocates from stack and heap)

https://www.boost.org/doc/libs/1_68_0/libs/dynamic_bitset/dynamic_bitset.html

The latter also has more sensible implementations of operator& and operator|. Before you invent a new thing, what is wrong with these classes?

Best regards,
Hans


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