阅读背景:

关于函数返回c++中的引用的问题。

来源:互联网 

Is it OK to return a reference to a local variable from a function? By local I mean that the variable would be created(on the stack i.e. without using new) within the function and its scope is within that function only. I got contradictory answers when I searched about this. 1) says that kind of usage is correct but 2) contradicts it.Is it OK to return a reference to a local varia




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: