Make sure that any function operating on more than one object behaves correctly if two or more of the objects are the same.
Item 11: Handle assignment to self in operator=(Effective C++)
转载Make sure operator= is well-behaved when an object is assigned to itself. Techniques include comparing addresses of source and target objects, careful statement ordering, and copy-and-swap.
Make sure that any function operating on more than one object behaves correctly if two or more of the objects are the same.
Make sure that any function operating on more than one object behaves correctly if two or more of the objects are the same.
本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:Item 12: Copy all parts of an object(Effective C++)
下一篇:Item 10: Have assignment operators return a reference to *this(Effective C++)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章