Union redux
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 2 16:07:09 PDT 2015
On 6/2/15 3:42 PM, Steven Schveighoffer wrote:
> 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?
Copying unions as a whole won't do any miracles. Just memcpy. -- Andrei
More information about the Digitalmars-d
mailing list