_com_ptr_t 提取器

Microsoft 专用

提取封装的 COM 接口指针。

operator Interface*( ) const throw( ); 
operator Interface&( ) const; 
Interface& operator*( ) const; 
Interface* operator->( ) const; 
Interface** operator&( ) throw( ); 
operator bool( ) const throw( );

备注

  • operator Interface*  返回封装的接口指针,这可能为 NULL

  • operator Interface& 返回对封装的接口指针的引用,并发布错误(如果指针为 NULL)。

  • operator*  允许智能指针对象在取消引用时充当实际封装的接口。

  • operator-> 允许智能指针对象在取消引用时充当实际封装的接口。

  • operator& 释放所有封装的接口指针,将其替换为 NULL,并返回封装的指针的地址。 这允许智能指针通过寻址传递到拥有 out 参数的函数,它通过该参数返回接口指针。

  • operator bool  允许智能指针对象用于一个条件表达式中。 如果该指针不为 NULL,则此运算符返回 true

结束 Microsoft 专用

请参见

参考

_com_ptr_t 类