Returning Large Objects in Functions

后端 未结 9 1244
無奈伤痛
無奈伤痛 2020-11-27 14:17

Compare the following two pieces of code, the first using a reference to a large object, and the second has the large object as the return value. The emphasis on a \"large o

9条回答
  •  执念已碎
    2020-11-27 14:56

    Alternatively, you can avoid this issue all together by letting the object get its own data, i. e. by making getObjData() a member function of LargeObj. Depending on what you are actually doing, this may be a good way to go.

提交回复
热议问题