1
下面是一個例子片段:是否將智能指針分配給_variant_t需要手動AddRef()?
_variant_t var;
var.vt = VT_UNKNOWN;
var.punkVal = unknownInterfaceSmartPointer;
unknownInterfaceSmartPointer->AddRef(); // Question Statement
// Setting unknownInterfaceSmartPointer to some other container
是否真的在這裏需要手動的AddRef?以下將是比這更好的方式:
_variant_t var(unknownInterfaceSmartPointer.GetInterfacePointer());
你的想法?
很好,謝謝.. – AksharRoop