26 Oct
2018
26 Oct
'18
8:08 a.m.
On 26. Oct 2018, at 09:35, Andrzej Krzemienski via Boost
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.htm... 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