我有一种情况需要传递 CComPtr<IXmlReader>
通过引用到一个函数。被调用参数是否从被调用参数中获取所有权(或)引用计数增加?
void foo( CComPtr<IXmlReader> & pReader )
{
// There is no reassignment of the CComPtr.
// Just call the IXmlReader methods.
}
CComPtr<IXmlReader> pReader;
foo( pReader );
// Is pReader still valid after the function return ?
谢谢。
最佳答案
如果没有重新赋值,为什么是引用参数?
无论如何,引用计数没有变化。是的,返回后CComPtr仍然有效。
关于c++ - CComPtr 通过引用传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10104907/