Displaying 2 results from an estimated 2 matches for "add_subclass_bitfield".
2019 Dec 24
2
RFC: Refactor SubclassData
...d, will have to be adjusted accordingly -
which can be very tedious and error-prone.
I offer a small set of macros which will take care of the whole
Subclass-Data.
It will work as follows:
struct A {
int SubclassData : 14;
DEFINE_SUBCLASS_DATA()
};
struct B : A {
BEGIN_SUBCLASS_DATA()
ADD_SUBCLASS_BITFIELD(int, 5, B1) // A::SubclassData bits [0,5)
ADD_SUBCLASS_BITFIELD(bool, 1, B2) // A::SubclassData bits [5,6)
ADD_SUBCLASS_BITFIELD(short, 6, B3) // A::SubclassData bits [6,12)
// ADD_SUBCLASS_BITFIELD(int, 6, B4) // A::SubclassData bits [12,18) -
triggers a static_assert, as it exceeds the 14 b...
2019 Dec 26
2
RFC: Refactor SubclassData
...of macros which will take care of the whole
>> Subclass-Data.
>> It will work as follows:
>>
>> struct A {
>> int SubclassData : 14;
>>
>> DEFINE_SUBCLASS_DATA()
>> };
>>
>> struct B : A {
>> BEGIN_SUBCLASS_DATA()
>> ADD_SUBCLASS_BITFIELD(int, 5, B1) // A::SubclassData bits [0,5)
>> ADD_SUBCLASS_BITFIELD(bool, 1, B2) // A::SubclassData bits [5,6)
>> ADD_SUBCLASS_BITFIELD(short, 6, B3) // A::SubclassData bits [6,12)
>> // ADD_SUBCLASS_BITFIELD(int, 6, B4) // A::SubclassData bits [12,18) -
>> triggers a s...