www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is the automatic opAssign exception-safe?

Does opAssign still work the way I quote from 

S* opAssign(S s)
{   ... bitcopy *this into tmp ...
     ... bitcopy s into *this ...
     ... call destructor on tmp ...
     return this;

The reason for the temporary must be exception safety. Otherwise, one 
would simply destroy *this and then copy from s. Am I correct?

Additionally, I suspect that the 'bitcopy's above are actually 
memberwise copies, calling each member's post-blit function. If so, then 
a member's post-blit may throw and the above code is not exception-safe 

Is the documentation old, and opAssign is in fact exception-safe? If it 
was never intended to be, then why the temporary?

Thank you,
Dec 27 2009