Union redux

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 2 15:42:40 PDT 2015


On 6/2/15 6:14 PM, Andrei Alexandrescu wrote:
> On 6/2/15 2:57 PM, Timon Gehr wrote:
>> OK. What about copying in instead of out?
>
> If the appropriate type has already been constructed, assignment
> suffices. Otherwise, emplace(&target, source) is needed. -- Andrei

My concern is if you copy the enclosing type. This means you have 
already copied the bits, and the postblit of the enclosing type is 
responsible for calling the postblit of the valid union member (as 
defined by the semantics of the type). How does it do that?

-Steve


More information about the Digitalmars-d mailing list