What's this? (Was: DMD 1.028 and 2.012 releases)
Aarti_pl
aarti at interia.pl
Fri Mar 7 01:44:31 PST 2008
Walter Bright pisze:
> Aarti_pl wrote:
>> Did you notice this example in docs?
>> (http://www.digitalmars.com/d/2.0/struct.html#AssignOverload)
>>
>>
>> S* opAssign(S s)
>> { S tmp <== *this; // bitcopy *this into tmp
>> *this <== s; // bitcopy s into *this
>> tmp.~this(); // call destructor on tmp
>> return this;
>> }
>>
>> It seems to be something new in D 2.012. Does it work? How?
>
> It's pseudo-code. There is no <== operator nor .~this() in D. I probably
> made a mistake in presenting it this way, but I was trying to show what
> was going on.
>
> The comments explain what is happening.
Yes, such a pseudo-code should probably be avoided.
I thought that there was silently introduced special copy operator.
... the one that would disambiguate ref copying from object copying for
example :-)
BR
Marcin Kuszczak
(aarti_pl)
More information about the Digitalmars-d-announce
mailing list