Possible Duplicate:
How to disable return value optimization in Visual Studio 2010?
I am implement my intrusive ptr and have a problem. When some method return my smart pointer than don't called copy constructor. How to disable RVO in MS VS2012 ?
Possible Duplicate:
How to disable return value optimization in Visual Studio 2010?
I am implement my intrusive ptr and have a problem. When some method return my smart pointer than don't called copy constructor. How to disable RVO in MS VS2012 ?
You don't need to disable RVO, because you don't need the copy constructor call, because the RVO elision means that the object isn't copied, so there's no extra reference counting to be done.
In short, the optimization doesn't change a thing for correct code, other than speed and memory consumption.