C++ references vs return values

前端 未结 4 1923
天涯浪人
天涯浪人 2021-01-12 15:34

I understand the principle point of references is to avoid making copies of large structures, but what if a function you\'re writing itself creates a large structure? Is it

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 16:11

    That depends on if your compiler supports return value optimization (most do) and if the code qualifies for that optimization.

提交回复
热议问题