Can I use placement new(this) in operator=?

后端 未结 2 1434
遇见更好的自我
遇见更好的自我 2020-12-11 03:14

Background: I have a complicated class with many variables. I have a sound and tested copy constructor:

Applepie::Applepie( const Applepie          


        
2条回答
  •  一个人的身影
    2020-12-11 04:03

    In addition to Rene's answer, there is also the problem of what would happen if ApplePie was a base class of the actual object: ApplePie would be replacing the object with an object of the wrong type!

提交回复
热议问题