You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,12 +12,12 @@ A smart pointer class for managing COM interface pointers.
11
12
12
13
## Syntax
13
14
14
-
```
15
+
```cpp
15
16
template<classT>
16
17
classCComPtr
17
18
```
18
19
19
-
####Parameters
20
+
### Parameters
20
21
21
22
*T*<br/>
22
23
A COM interface specifying the type of pointer to be stored.
@@ -37,9 +38,9 @@ A COM interface specifying the type of pointer to be stored.
37
38
38
39
## Remarks
39
40
40
-
ATL uses `CComPtr` and [CComQIPtr](../../atl/reference/ccomqiptr-class.md) to manage COM interface pointers. Both are derived from [CComPtrBase](../../atl/reference/ccomptrbase-class.md), and both perform automatic reference counting.
41
+
ATL uses `CComPtr` and [CComQIPtr](../../atl/reference/ccomqiptr-class.md) to manage COM interface pointers. Both are derived from [CComPtrBase](../../atl/reference/ccomptrbase-class.md), and both do automatic reference counting.
41
42
42
-
The `CComPtr` and [CComQIPtr](../../atl/reference/ccomqiptr-class.md) classes can help eliminate memory leaks by performing automatic reference counting. The following functions both perform the same logical operations; however, note how the second version may be less error-prone by using the `CComPtr` class:
43
+
The `CComPtr` and [CComQIPtr](../../atl/reference/ccomqiptr-class.md) classes can help eliminate memory leaks by performing automatic reference counting. The following functions both do the same logical operations. However, the second version may be less error-prone because it uses the `CComPtr` class:
@@ -57,11 +58,11 @@ In Debug builds, link atlsd.lib for code tracing.
57
58
58
59
**Header:** atlbase.h
59
60
60
-
## <aname="ccomptr"></a> CComPtr::CComPtr
61
+
## <a name="ccomptr"></a> CComPtr::CComPtr
61
62
62
63
The constructor.
63
64
64
-
```
65
+
```cpp
65
66
CComPtr() throw ();
66
67
CComPtr(T* lp) throw ();
67
68
CComPtr (const CComPtr<T>& lp) throw ();
@@ -75,11 +76,15 @@ Used to initialize the interface pointer.
75
76
*T*<br/>
76
77
A COM interface.
77
78
78
-
## <aname="operator_eq"></a> CComPtr::operator =
79
+
### Remarks
80
+
81
+
The constructors that take an argument call `AddRef` on *lp*, if it isn't a null pointer. A non-null owned object gets a `Release` call upon the CComPtr object's destruction, or if a new object is assigned to the CComPtr object.
0 commit comments