smart pointer for interior pointers

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 28 06:20:17 PDT 2015


On 5/27/15 9:13 PM, ketmar wrote:
> On Wed, 27 May 2015 17:31:32 -0600, Steven Schveighoffer wrote:
>
>> But we can solve this with a postblit:
>
> seems that you forgot about "move" semantics for structs. under some
> conditions struct can be "moved", not "copied", so it `memcpy`ed and no
> postblit will be called.
>

Right, that is a drawback of the first form. You have to ensure that 
doesn't happen (which is why we say struct interior pointers are illegal).

The real proposal doesn't have that issue, and that's actually the point 
of it :)

-Steve


More information about the Digitalmars-d mailing list