_com_ptr_t::operator =

Microsoft Specific

_com_ptr_t& operator=( Interface* pInterface ) throw( );

_com_ptr_t& operator=( int NULL ) throw( _com_error );

template< > _com_ptr_t& operator=( const _com_ptr_t& cp ) throw( );

template< > _com_ptr_t& operator=( const _variant_t& varSrc ) throw( _com_error );

template<typename _InterfacePtr> _com_ptr_t& operator=( const _InterfacePtr& p ) throw( _com_error );

Remarks

Assigns an interface pointer to this _com_ptr_t object:

  • operator=( pInterface )   Encapsulates a raw interface pointer of this smart pointer’s type. AddRef is called to increment the reference count for the encapsulated interface pointer, and Release is called to decrement the reference count for the previously encapsulated pointer.

  • operator=( NULL )   Sets a smart pointer to NULL. The NULL argument must be a zero.

  • operator=( cp )   Sets a smart pointer to be a copy of another instance of the same smart pointer of the same type. AddRef is called to increment the reference count for the encapsulated interface pointer, and Release is called to decrement the reference count for the previously encapsulated pointer.

  • operator=( varSrc )   Sets a smart pointer to be a _variant_t object. The encapsulated VARIANT must be of type VT_DISPATCH or VT_UNKNOWN, or it can be converted to one of these two types. If QueryInterface fails with an E_NOINTERFACE error, a NULL smart pointer results. Any other error causes a _com_error to be raised.

  • operator=( p )   Sets a smart pointer to be a different smart pointer of a different type or a different raw interface pointer. QueryInterface is called to find an interface pointer of this smart pointer’s type, and Release is called to decrement the reference count for the previously encapsulated pointer. If QueryInterface fails with an E_NOINTERFACE, a NULL smart pointer results. Any other error causes a _com_error to be raised.

_com_ptr_t Overview

END Microsoft Specific