Union redux

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 1 14:40:14 PDT 2015


On 6/1/15 5:36 PM, Andrei Alexandrescu wrote:
> On 6/1/15 2:22 PM, Steven Schveighoffer wrote:
>> I would make it clear here what you mean. I can't tell what "the rule"
>> is (there may be 2 rules, or 1, but I can't tell), and whether Andrei
>> agrees we should do it or not.
>
> Unions should accept all types, including those with @disabled or
> elaborated constructors/postblits/dtors. Essentially a union is
> appropriate storage for any type mentioned in its members, whilst
> leaving it to its user to write and read the needed values. -- Andrei
>

So what happens on destruction? What about postblit? This was the piece 
I'm not understanding.

For D, requiring that a struct can be constructed statically is a win here.

-Steve


More information about the Digitalmars-d mailing list