Skip to content

Commit e123ba0

Browse files
author
Colin Robertson
committed
Address issue 2239 in WRL docs ComPtr::Reset
1 parent 10162c2 commit e123ba0

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

docs/cppcx/wrl/comptr-class.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "ComPtr Class"
3-
ms.date: "07/26/2019"
3+
ms.date: "06/02/2020"
44
ms.topic: "reference"
55
f1_keywords: ["client/Microsoft::WRL::ComPtr", "client/Microsoft::WRL::ComPtr::As", "client/Microsoft::WRL::ComPtr::AsIID", "client/Microsoft::WRL::ComPtr::AsWeak", "client/Microsoft::WRL::ComPtr::Attach", "client/Microsoft::WRL::ComPtr::ComPtr", "client/Microsoft::WRL::ComPtr::CopyTo", "client/Microsoft::WRL::ComPtr::Detach", "client/Microsoft::WRL::ComPtr::Get", "client/Microsoft::WRL::ComPtr::GetAddressOf", "client/Microsoft::WRL::ComPtr::InternalAddRef", "client/Microsoft::WRL::ComPtr::InternalRelease", "client/Microsoft::WRL::ComPtr::operator&", "client/Microsoft::WRL::ComPtr::operator->", "client/Microsoft::WRL::ComPtr::operator=", "client/Microsoft::WRL::ComPtr::operator==", "client/Microsoft::WRL::ComPtr::operator!=", "client/Microsoft::WRL::ComPtr::operator Microsoft::WRL::Details::BoolType", "client/Microsoft::WRL::ComPtr::ptr_", "client/Microsoft::WRL::ComPtr::ReleaseAndGetAddressOf", "client/Microsoft::WRL::ComPtr::Reset", "client/Microsoft::WRL::ComPtr::Swap", "client/Microsoft::WRL::ComPtr::~ComPtr"]
66
helpviewer_keywords: ["Microsoft::WRL::ComPtr class", "Microsoft::WRL::ComPtr::As method", "Microsoft::WRL::ComPtr::AsIID method", "Microsoft::WRL::ComPtr::AsWeak method", "Microsoft::WRL::ComPtr::Attach method", "Microsoft::WRL::ComPtr::ComPtr, constructor", "Microsoft::WRL::ComPtr::CopyTo method", "Microsoft::WRL::ComPtr::Detach method", "Microsoft::WRL::ComPtr::Get method", "Microsoft::WRL::ComPtr::GetAddressOf method", "Microsoft::WRL::ComPtr::InternalAddRef method", "Microsoft::WRL::ComPtr::InternalRelease method", "Microsoft::WRL::ComPtr::operator& operator", "Microsoft::WRL::ComPtr::operator-> operator", "Microsoft::WRL::ComPtr::operator= operator", "Microsoft::WRL::ComPtr::operator== operator", "Microsoft::WRL::ComPtr::operator!= operator", "Microsoft::WRL::ComPtr::operator Microsoft::WRL::Details::BoolType operator", "Microsoft::WRL::ComPtr::ptr_ data member", "Microsoft::WRL::ComPtr::ReleaseAndGetAddressOf method", "Microsoft::WRL::ComPtr::Reset method", "Microsoft::WRL::ComPtr::Swap method", "Microsoft::WRL::ComPtr::~ComPtr, destructor"]
@@ -32,7 +32,7 @@ A class to which the current `ComPtr` is a friend. (The template that uses this
3232

3333
`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.
3434

35-
For more information about smart pointers, see the "COM Smart Pointers" subsection of the [COM Coding Practices](/windows/win32/LearnWin32/com-coding-practices) topic in the MSDN Library.
35+
For more information about smart pointers, see the "COM Smart Pointers" subsection of the [COM Coding Practices](/windows/win32/LearnWin32/com-coding-practices) article in the MSDN Library.
3636

3737
## Members
3838

@@ -46,7 +46,7 @@ Name | Description
4646

4747
Name | Description
4848
-------------------------------- | --------------------------------------------------------------------------------------------------------------------
49-
[ComPtr::ComPtr](#comptr) | Intializes a new instance of the `ComPtr` class. Overloads provide default, copy, move, and conversion constructors.
49+
[ComPtr::ComPtr](#comptr) | Initializes a new instance of the `ComPtr` class. Overloads provide default, copy, move, and conversion constructors.
5050
[ComPtr::~ComPtr](#tilde-comptr) | Deinitializes an instance of `ComPtr`.
5151

5252
### Public Methods
@@ -62,7 +62,7 @@ Name | Description
6262
[ComPtr::Get](#get) | Retrieves a pointer to the interface that is associated with this `ComPtr`.
6363
[ComPtr::GetAddressOf](#getaddressof) | Retrieves the address of the [ptr_](#ptr) data member, which contains a pointer to the interface represented by this `ComPtr`.
6464
[ComPtr::ReleaseAndGetAddressOf](#releaseandgetaddressof) | Releases the interface associated with this `ComPtr` and then retrieves the address of the [ptr_](#ptr) data member, which contains a pointer to the interface that was released.
65-
[ComPtr::Reset](#reset) | Releases all references for the pointer to the interface that is associated with this `ComPtr`.
65+
[ComPtr::Reset](#reset) | Releases the interface associated with this `ComPtr` and returns the new reference count.
6666
[ComPtr::Swap](#swap) | Exchanges the interface managed by the current `ComPtr` with the interface managed by the specified `ComPtr`.
6767

6868
### Protected Methods
@@ -80,8 +80,8 @@ Name
8080
[ComPtr::operator->](#operator-arrow) | Retrieves a pointer to the type specified by the current template parameter.
8181
[ComPtr::operator=](#operator-assign) | Assigns a value to the current `ComPtr`.
8282
[ComPtr::operator==](#operator-equality) | Indicates whether two `ComPtr` objects are equal.
83-
[ComPtr::operator!=](#operator-inequality) | Indicates whether two `ComPtr` objects are not equal.
84-
[ComPtr::operator Microsoft::WRL::Details::BoolType](#operator-microsoft-wrl-details-booltype) | Indicates whether or not a `ComPtr` is managing the object lifetime of an interface.
83+
[ComPtr::operator!=](#operator-inequality) | Indicates whether two `ComPtr` objects aren't equal.
84+
[ComPtr::operator Microsoft::WRL::Details::BoolType](#operator-microsoft-wrl-details-booltype) | Indicates whether a `ComPtr` is managing the object lifetime of an interface.
8585

8686
### Protected Data Members
8787

@@ -133,7 +133,7 @@ A `ComPtr` object that represents the interface specified by parameter *U*. Para
133133

134134
### Remarks
135135

136-
The first template is the form that you should use in your code. The second template is an internal, helper specialization that supports C++ language features such as the [auto](../../cpp/auto-cpp.md) type deduction keyword.
136+
The first template is the form that you should use in your code. The second template is an internal, helper specialization. It supports C++ language features such as the [auto](../../cpp/auto-cpp.md) type deduction keyword.
137137

138138
### Return Value
139139

@@ -156,7 +156,7 @@ WRL_NOTHROW HRESULT AsIID(
156156
An interface ID.
157157

158158
*p*<br/>
159-
If the object has an interface whose ID equals *riid*, a doubly-indirect pointer to the interface specified by the *riid* parameter; otherwise, a pointer to `IUnknown`.
159+
If the object has an interface whose ID equals *riid*, a doubly indirect pointer to the interface specified by the *riid* parameter. Otherwise, a pointer to `IUnknown`.
160160

161161
### Return Value
162162

@@ -198,7 +198,7 @@ An interface type.
198198

199199
## <a name="comptr"></a> ComPtr::ComPtr
200200

201-
Intializes a new instance of the `ComPtr` class. Overloads provide default, copy, move, and conversion constructors.
201+
Initializes a new instance of the `ComPtr` class. Overloads provide default, copy, move, and conversion constructors.
202202

203203
```cpp
204204
WRL_NOTHROW ComPtr();
@@ -244,13 +244,13 @@ An object of type *U*.
244244

245245
### Remarks
246246

247-
The first constructor is the default constructor, which implictly creates an empty object. The second constructor specifies [__nullptr](../../extensions/nullptr-cpp-component-extensions.md), which explicitly creates an empty object.
247+
The first constructor is the default constructor, which implicitly creates an empty object. The second constructor specifies [__nullptr](../../extensions/nullptr-cpp-component-extensions.md), which explicitly creates an empty object.
248248

249249
The third constructor creates an object from the object specified by a pointer. The ComPtr now owns the pointed-to memory and maintains a reference count to it.
250250

251-
The fourth and fifth constructors are copy constructors. The fifth constructor copies an object if it is convertible to the current type.
251+
The fourth and fifth constructors are copy constructors. The fifth constructor copies an object if it's convertible to the current type.
252252

253-
The sixth and seventh constructors are move constructors. The seventh constructor moves an object if it is convertible to the current type.
253+
The sixth and seventh constructors are move constructors. The seventh constructor moves an object if it's convertible to the current type.
254254

255255
## <a name="copyto"></a> ComPtr::CopyTo
256256

@@ -349,7 +349,7 @@ This method is protected.
349349
Performs a COM Release operation on the interface associated with this `ComPtr`.
350350

351351
```cpp
352-
void InternalRelease();
352+
unsigned long InternalRelease();
353353
```
354354

355355
### Remarks
@@ -372,7 +372,7 @@ A weak reference to the current `ComPtr`.
372372

373373
### Remarks
374374

375-
This method differs from [ComPtr::GetAddressOf](#getaddressof) in that this method releases a reference to the interface pointer. Use `ComPtr::GetAddressOf` when you require the address of the interface pointer but do not want to release that interface.
375+
This method differs from [ComPtr::GetAddressOf](#getaddressof) in that this method releases a reference to the interface pointer. Use `ComPtr::GetAddressOf` when you require the address of the interface pointer but don't want to release that interface.
376376

377377
## <a name="operator-arrow"></a> ComPtr::operator-&gt;
378378

@@ -437,11 +437,11 @@ A reference to the current `ComPtr`.
437437

438438
The first version of this operator assigns an empty value to the current `ComPtr`.
439439

440-
In the second version, if the assigning interface pointer is not the same as the current `ComPtr` interface pointer, the second interface pointer is assigned to the current `ComPtr`.
440+
In the second version, if the assigning interface pointer isn't the same as the current `ComPtr` interface pointer, the second interface pointer is assigned to the current `ComPtr`.
441441

442442
In the third version, the assigning interface pointer is assigned to the current `ComPtr`.
443443

444-
In the fourth version, if the interface pointer of the assigning value is not the same as the current `ComPtr` interface pointer, the second interface pointer is assigned to the current `ComPtr`.
444+
In the fourth version, if the interface pointer of the assigning value isn't the same as the current `ComPtr` interface pointer, the second interface pointer is assigned to the current `ComPtr`.
445445

446446
The fifth version is a copy operator; a reference to a `ComPtr` is assigned to the current `ComPtr`.
447447

@@ -486,7 +486,7 @@ The second and third operators yield `true` if object *a* is equal to `nullptr`;
486486

487487
## <a name="operator-inequality"></a> ComPtr::operator!=
488488

489-
Indicates whether two `ComPtr` objects are not equal.
489+
Indicates whether two `ComPtr` objects aren't equal.
490490

491491
```cpp
492492
bool operator!=(
@@ -515,13 +515,13 @@ A reference to another `ComPtr` object.
515515

516516
### Return Value
517517

518-
The first operator yields `true` if object *a* is not equal to object *b*; otherwise, `false`.
518+
The first operator yields `true` if object *a* isn't equal to object *b*; otherwise, `false`.
519519

520-
The second and third operators yield `true` if object *a* is not equal to `nullptr`; otherwise, `false`.
520+
The second and third operators yield `true` if object *a* isn't equal to `nullptr`; otherwise, `false`.
521521

522522
## <a name="operator-microsoft-wrl-details-booltype"></a> ComPtr::operator Microsoft::WRL::Details::BoolType
523523

524-
Indicates whether or not a `ComPtr` is managing the object lifetime of an interface.
524+
Indicates whether a `ComPtr` is managing the object lifetime of an interface.
525525

526526
```cpp
527527
WRL_NOTHROW operator Microsoft::WRL::Details::BoolType() const;
@@ -557,15 +557,15 @@ The address of the [ptr_](#ptr) data member of this `ComPtr`.
557557

558558
## <a name="reset"></a> ComPtr::Reset
559559

560-
Releases all references for the pointer to the interface that is associated with this `ComPtr`.
560+
Releases the interface associated with this `ComPtr` and returns the new reference count.
561561

562562
```cpp
563563
unsigned long Reset();
564564
```
565565

566566
### Return Value
567567

568-
The number of references released, if any.
568+
The number of references remaining to the underlying interface, if any.
569569

570570
## <a name="swap"></a> ComPtr::Swap
571571

0 commit comments

Comments
 (0)