Bit-field
From cppreference.com
Declares a class data member with explicit size, in bits. Adjacent bit-field members may (or may not) be packed to share and straddle the individual bytes.
A bit-field declaration is a class data member declaration which uses the following declarator:
identifier (optional) attr (optional) : size
|
(1) | ||||||||
identifier (optional) attr (optional) : size brace-or-equal-initializer
|
(2) | (since C++20) | |||||||
The type of the bit-field is introduced by the decl-specifier-seq of the declaration syntax.
attr | - | (since C++11) sequence of any number of attributes |
identifier | - | the name of the bit-field that is being declared. The name is optional: unnamed bit-fields introduce the specified number of padding bits. |
size | - | an integral constant expression with a value greater or equal to zero. When greater than zero, this is the number of bits that this bit-field will occupy. The value zero is only allowed for nameless bit-fields and has special meaning. |
brace-or-equal-initializer | - | default member initializer to be used with this bit-field |
Contents |