compiler optimization

前端 未结 4 476
耶瑟儿~
耶瑟儿~ 2021-02-05 23:01

So I have a question for you. :) Can you tell me the output the following code should produce?

#include 
struct Optimized
{
    Optimized() { std         


        
4条回答
  •  执笔经年
    2021-02-05 23:32

    Even when passing back by value the compiler can optimise the extra copy away using Return Value Optimisation see; http://en.wikipedia.org/wiki/Return_value_optimization

提交回复
热议问题