[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Creates a smart pointer type that represents the interface specified by the template parameter. ComPtr automatically maintains a reference count for the underlying interface pointer and releases the interface when the reference count goes to zero.
template <
typename T
>
class ComPtr;
template<
class U
>
friend class ComPtr;
ComPtr<> declares a type that represents the underlying interface pointer. Use ComPtr<> to declare a variable and then use the arrow member-access operator (->) to access an interface member function.
For more information about smart pointers, see the "COM Smart Pointers" subsection of the COM Coding Practices topic in the MSDN Library.
Public Typedefs
|
Name |
Description |
|---|---|
|
InterfaceType |
A synonym for the type specified by the T template parameter. |
Public Constructors
|
Name |
Description |
|---|---|
|
Intializes a new instance of the ComPtr class. Overloads provide default, copy, move, and conversion constructors. |
|
|
Deinitializes an instance of ComPtr. |
Public Methods
|
Name |
Description |
|---|---|
|
Returns a ComPtr object that represents the interface identified by the specified template parameter. |
|
|
Returns a ComPtr object that represents the interface identified by the specified interface ID. |
|
|
Retrieves a weak reference to the current object. |
|
|
Associates this ComPtr with the interface type specified by the current template type parameter. |
|
|
Copies the current or specified interface associated with this ComPtr to the specified output pointer. |
|
|
Disassociates this ComPtr from the interface that it represents. |
|
|
Retrieves a pointer to the interface that is associated with this ComPtr. |
|
|
Retrieves the address of the ptr_ data member, which contains a pointer to the interface represented by this ComPtr. |
|
|
Releases the interface associated with this ComPtr and then retrieves the address of the ptr_ data member, which contains a pointer to the interface that was released. |
|
|
Exchanges the interface managed by the current ComPtr with the interface managed by the specified ComPtr. |
Protected Methods
|
Name |
Description |
|---|---|
|
Increments the reference count of the interface associated with this ComPtr. |
|
|
Performs a COM Release operation on the interface associated with this ComPtr. |
Public Operators
|
Name |
Description |
|---|---|
|
Indicates whether or not a ComPtr is managing the object lifetime of an interface. |
|
|
Retrieves the address of the current ComPtr. |
|
|
Assigns a value to the current ComPtr. |
|
|
Retrieves a pointer to the type specified by the current template parameter. |
|
|
Indicates whether two ComPtr objects are equal. |
|
|
Indicates whether two ComPtr objects are not equal. |
Protected Data Members
|
Name |
Description |
|---|---|
|
Contains a pointer to the interface that is associated with, and managed by this ComPtr. |

