Skip to content

Commit 2d08539

Browse files
author
Colin Robertson
authored
Address 1820 constructor docs. (#2665)
1 parent 44c577a commit 2d08539

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

docs/atl/reference/ccomptr-class.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "CComPtr Class"
3-
ms.date: "11/04/2016"
3+
description: "Reference guide to the Microsoft C++ Active Template Library (ATL) class CComPtr."
4+
ms.date: "02/07/2020"
45
f1_keywords: ["CComPtr", "ATLBASE/ATL::CComPtr", "ATLBASE/ATL::CComPtr::CComPtr"]
56
helpviewer_keywords: ["CComPtr class"]
67
ms.assetid: 22d9ea8d-ed66-4c34-940f-141db11e83bd
@@ -11,12 +12,12 @@ A smart pointer class for managing COM interface pointers.
1112

1213
## Syntax
1314

14-
```
15+
```cpp
1516
template<class T>
1617
class CComPtr
1718
```
1819
19-
#### Parameters
20+
### Parameters
2021
2122
*T*<br/>
2223
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.
3738
3839
## Remarks
3940
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.
4142
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:
4344
4445
[!code-cpp[NVC_ATL_Utilities#130](../../atl/codesnippet/cpp/ccomptr-class_1.cpp)]
4546
@@ -57,11 +58,11 @@ In Debug builds, link atlsd.lib for code tracing.
5758
5859
**Header:** atlbase.h
5960
60-
## <a name="ccomptr"></a> CComPtr::CComPtr
61+
## <a name="ccomptr"></a> CComPtr::CComPtr
6162
6263
The constructor.
6364
64-
```
65+
```cpp
6566
CComPtr() throw ();
6667
CComPtr(T* lp) throw ();
6768
CComPtr (const CComPtr<T>& lp) throw ();
@@ -75,11 +76,15 @@ Used to initialize the interface pointer.
7576
*T*<br/>
7677
A COM interface.
7778

78-
## <a name="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.
82+
83+
## <a name="operator_eq"></a> CComPtr::operator =
7984

8085
Assignment operator.
8186

82-
```
87+
```cpp
8388
T* operator= (T* lp) throw ();
8489
T* operator= (const CComPtr<T>& lp) throw ();
8590
```

0 commit comments

Comments
 (0)