Skip to content

Commit 1fd78c6

Browse files
author
Colin Robertson
committed
Update for issue 2260
1 parent 2bc347b commit 1fd78c6

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

docs/cpp/com-ptr-t-extractors.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
title: "_com_ptr_t Extractors"
3-
ms.date: "11/04/2016"
3+
description: "Describes the extraction operators for the _com_ptr_t class."
4+
ms.date: 07/07/2020
45
f1_keywords: ["_com_ptr_t::operatorInterface&", "_com_ptr_t::operatorbool", "_com_ptr_t::operator->", "_com_ptr_t::operator*"]
56
helpviewer_keywords: ["operator Interface& [C++]", "* operator [C++], with specific objects", "operator& [C++]", "operator* [C++]", "-> operator [C++], with specific objects", "& operator [C++], with specific objects", "operator Interface* [C++]", "operator * [C++]", "operator->", "operator bool", "extractors, _com_ptr_t class", "extractors [C++]"]
67
ms.assetid: 194b9e0e-123c-49ff-a187-0a7fcd68145a
78
---
8-
# _com_ptr_t Extractors
9+
# `_com_ptr_t` Extractors
910

10-
**Microsoft Specific**
11+
**Microsoft-specific**
1112

1213
Extract the encapsulated COM interface pointer.
1314

1415
## Syntax
1516

16-
```
17+
```c++
1718
operator Interface*( ) const throw( );
1819
operator Interface&( ) const;
1920
Interface& operator*( ) const;
@@ -24,20 +25,21 @@ operator bool( ) const throw( );
2425
2526
## Remarks
2627
27-
- **operator Interface**<strong>\*</strong> Returns the encapsulated interface pointer, which may be NULL.
28+
- **`operator Interface*`** Returns the encapsulated interface pointer, which may be NULL.
2829
29-
- **operator Interface&** Returns a reference to the encapsulated interface pointer, and issues an error if the pointer is NULL.
30+
- **`operator Interface&`** Returns a reference to the encapsulated interface pointer, and issues an error if the pointer is NULL.
3031
31-
- **operator**<strong>\*</strong> Allows a smart pointer object to act as though it were the actual encapsulated interface when dereferenced.
32+
- **`operator*`** Allows a smart pointer object to act as though it were the actual encapsulated interface when dereferenced.
3233
33-
- **operator->** Allows a smart pointer object to act as though it were the actual encapsulated interface when dereferenced.
34+
- **`operator->`** Allows a smart pointer object to act as though it were the actual encapsulated interface when dereferenced.
3435
35-
- **operator&** Releases any encapsulated interface pointer, replacing it with NULL, and returns the address of the encapsulated pointer. This allows the smart pointer to be passed by address to a function that has an *out* parameter through which it returns an interface pointer.
36+
- **`operator&`** Releases any encapsulated interface pointer, replacing it with NULL, and returns the address of the encapsulated pointer. This operator allows you to pass the smart pointer by address to a function that has an *out* parameter through which it returns an interface pointer.
3637
37-
- **operator bool** Allows a smart pointer object to be used in a conditional expression. This operator returns TRUE if the pointer is not NULL.
38+
- **`operator bool`** Allows a smart pointer object to be used in a conditional expression. This operator returns TRUE if the pointer isn't NULL.
3839
39-
**END Microsoft Specific**
40+
> [!NOTE]
41+
> Because **`operator bool`** is not declared as **`explicit`**, `_com_ptr_t` is implicitly convertible to **`bool`**, which is convertible to any scalar type. This can have unexpected consequences in your code. Enable [Compiler Warning (level 4) C4800](../error-messages/compiler-warnings/compiler-warning-level-3-c4800.md) to prevent unintentional use of this conversion.
4042
4143
## See also
4244
43-
[_com_ptr_t Class](../cpp/com-ptr-t-class.md)
45+
[_com_ptr_t class](../cpp/com-ptr-t-class.md)

0 commit comments

Comments
 (0)