Have you considered the low-level approach of allowing the user to specify the exact location of fields within a class, perhaps by an extension to the bitfield syntax?

In your example,

struct A {
    // Feature A documentation
    bool feature_a_enabled : 30, 1;
    unsigned int feature_a_value : 16, 14;

    // Feature B documentation
    bool feature_b_enabled : 31, 1;
    unsigned int feature_b_value : 0, 16;

So the bitfield syntax would become : [offset, ] width where the offset is in bits from the beginning of the class. 

Of course, overlap would need to make the program ill-formed.

On Mon, Sep 9, 2019 at 8:00 PM Rene Rivera via SG14 <sg14@lists.isocpp.org> wrote:
My entry for the agenda at the CppCon meeting is...

"Member Layout Control"

It's "rough" first attempt at this. But it's good enough for discussion.

-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net

SG14 mailing list