| I l@ve RuBoard |
|
Item 41. Object Lifetimes桺art 2Difficulty: 6 Following from Item 40, this issue considers a C++ idiom that's frequently recommended梑ut often dangerously wrong. Critique the following "anti-idiom" (shown as commonly presented).
T& T::operator=( const T& other )
{
if( this != &other )
{
this->~T();
new (this) T(other);
}
return *this;
}
(See also Item 40.) |
| I l@ve RuBoard |
|