Can we just have struct inheritence already?

Nicholas Wilson iamthewilsonator at hotmail.com
Mon Jun 10 05:13:08 UTC 2019


On Monday, 10 June 2019 at 04:03:38 UTC, Nicholas Wilson wrote:
> There is a (proposal?) for a no unique address attribute to 
> disappear the address of structs the take up no room.

Found it:

https://en.cppreference.com/w/cpp/language/attributes/no_unique_address

Looks like there are a bunch of weird edge cases with it though:

struct Empty {};

struct Z {
     char c;
     [[no_unique_address]] Empty e1, e2;
};

     // e1 and e2 cannot share the same address because they have 
the
     // same type, even though they are marked with 
[[no_unique_address]].
     // However, either may share address with c.
     static_assert(sizeof(Z) >= 2);



More information about the Digitalmars-d mailing list