Struct dtor on ref variable
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 1 09:17:51 PDT 2016
On Monday, 1 August 2016 at 16:14:31 UTC, Patric wrote:
> On Monday, 1 August 2016 at 16:05:51 UTC, Steven Schveighoffer
> wrote:
>> On 8/1/16 12:01 PM, Patric wrote:
>>
>>> I expected nothing to happen because "ref" its a simple
>>> pointer, right?
>>> Or I am missing something here?
>>>
>>
>> You want opAssign, not opOpAssign. opOpAssign is for things
>> like +=.
>>
>> Your code had me worried for a while :)
>>
>> -Steve
>
> Same thing:
> (Remembered now of DPaste)
> (and I understand your concern :P)
> https://dpaste.dzfl.pl/af512b5f6288
You've implemented opAssign incorrectly. See:
https://dlang.org/spec/operatoroverloading.html#assignment
More information about the Digitalmars-d-learn
mailing list