我很困惑:
我正在寻找在基本 C++ 中从 C++ 函数返回对象的正确方法(没有库处理指针和自动释放内存).我想知道这应该怎么做.
I am looking for the proper way to return an object from a C++ function, in basic C++ (no library handling pointers and freeing memory automatically). I want to know how this is supposed to be done.
谢谢
现代编译器通常实现 (命名)返回值优化,通过它您引用的副本(并且在逻辑上期望)没有完成.
Modern compilers typically implement the (Named) Return Value Optimization, by which the copy you reference (and would logically expect) is not done.
从 Visual Studio 2005 (VC++ 8.0) 开始,我就不再考虑返回对象.
Ever since Visual Studio 2005 (VC++ 8.0) I don't think twice about returning objects.
这篇关于从 C++ 函数返回对象的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!