
10 Sep
2008
10 Sep
'08
6:22 p.m.
Andrey Semashev wrote:
One downside is that self-assignment is made suboptimal. My typical operator= implementation is:
T& operator= (T const& that) { if (this != &that) T(that).swap(*this); return *this; }
Not sure, however, if it is critical enough.
In practice I haven't written any interesting code that does self assignment. Perhaps you have. In my code I'd consider this a pessimization. Thanks, Michael Marcin