C++ copy-construct construct-and-assign question

前端 未结 3 624
北恋
北恋 2020-12-03 23:06

Here is an extract from item 56 of the book \"C++ Gotchas\":

It\'s not uncommon to see a simple initialization of a Y object written any of three

3条回答
  •  悲哀的现实
    2020-12-03 23:41

    The compiler is permitted to optimize cases b and c to be the same as a. Further, copy construction and assignment operator calls can be wholly eliminated by the compiler anyway, so whatever you see isn't necessarily the same with different compilers or even compiler settings.

提交回复
热议问题