
22 Mar
2017
22 Mar
'17
6:39 a.m.
On 21 Mar 2017, at 19:23, Steven Watanabe via Boost
wrote: AMDG
On 03/21/2017 10:31 AM, Роман Орлов via Boost wrote:
<snip> class eats_meat; class eats_grass; class has_tail; Then bind these types to flag identifiers typedef typed_flags
animal; what's wrong with struct animal { bool eats_meat : 1; bool eats_grass : 1; bool has_tail : 1; };
To me standard C bitfields fit the bill, and is what I will use as long as I do not need to do bitwise operations on the flags. For just setting and reading them, it works fine and is simple to use. Beyond that, allthough outside this topic I really wish the language had the ability to take better control of the binary representation and layout of C bitfields for binary data portability. — Bjørn