assignment to this

Neal Alexander wqeqweuqy at
Tue Jul 24 21:06:24 PDT 2007

Jarrett Billingsley wrote:
> "Regan Heath" <regan at> wrote in message 
> news:f7khch$tqs$1 at
>> I agree with the OP tho, it should either work as you'd expect or error.
> Assigning to 'this' if the aggregate has an overloaded opAssign is perfectly 
> fine; but yes, I think that trying to reassign which instance 'this' points 
> to should be an error. 
*(cast(void**)&this) = cast(void*) __instance__;


Theres no reason to make an artificial restraint for it. Its usefull when 
patching a COM object's vtable out from under someone.

More information about the Digitalmars-d-learn mailing list