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
Outputs, at a port, a byte (`outp`, `_outp`), a word (`outpw`, `_outpw`), or a double word (`_outpd`).
16
16
@@ -37,10 +37,10 @@ unsigned long _outpd(
37
37
38
38
### Parameters
39
39
40
-
*port*\
40
+
*`port`*\
41
41
Port number.
42
42
43
-
*data_byte, data_word*\
43
+
*`data_byte`*, *`data_word`*\
44
44
Output values.
45
45
46
46
## Return Value
@@ -49,7 +49,7 @@ The functions return the data output. There's no error return.
49
49
50
50
## Remarks
51
51
52
-
The `_outp`, `_outpw`, and `_outpd` functions write a byte, a word, and a double word, respectively, to the specified output port. The *port* argument can be any unsigned integer in the range 0 - 65,535. *data_byte* can be any integer in the range 0 - 255. *data_word* can be any value in the range of an integer, an unsigned short integer, and an unsigned long integer, respectively.
52
+
The `_outp`, `_outpw`, and `_outpd` functions write a byte, a word, and a double word, respectively, to the specified output port. The *`port`* argument can be any unsigned integer in the range 0 - 65,535. *`data_byte`* can be any integer in the range 0 - 255. *`data_word`* can be any value in the range of an integer, an unsigned short integer, and an unsigned long integer, respectively.
53
53
54
54
Because these functions write directly to an I/O port, they can't be used in user-mode Windows code.
helpviewer_keywords: ["_variant_t class [C++], constructor", "_variant_t method [C++]"]
7
7
ms.assetid: a50e5b33-d4c6-4a26-8e7e-a0a25fd9895b
8
8
---
9
-
# _variant_t::_variant_t
9
+
# `_variant_t::_variant_t`
10
10
11
11
**Microsoft Specific**
12
12
13
13
Constructs a `_variant_t` object.
14
14
15
15
## Syntax
16
16
17
-
```
17
+
```cpp
18
18
_variant_t( ) throw( );
19
19
20
20
_variant_t(
@@ -120,114 +120,114 @@ _variant_t(
120
120
) throw();
121
121
```
122
122
123
-
####Parameters
123
+
### Parameters
124
124
125
-
*varSrc*<br/>
125
+
*`varSrc`*\
126
126
A `VARIANT` object to be copied into the new `_variant_t` object.
127
127
128
-
*pVarSrc*<br/>
128
+
*`pVarSrc`*\
129
129
Pointer to a `VARIANT` object to be copied into the new `_variant_t` object.
130
130
131
-
*var_t_Src*<br/>
131
+
*`var_t_Src`*\
132
132
A `_variant_t` object to be copied into the new `_variant_t` object.
133
133
134
-
*fCopy*<br/>
134
+
*`fCopy`*\
135
135
If **`false`**, the supplied `VARIANT` object is attached to the new `_variant_t` object without making a new copy by `VariantCopy`.
136
136
137
-
*ISrc, sSrc*<br/>
137
+
*`ISrc`*, *`sSrc`*\
138
138
An integer value to be copied into the new `_variant_t` object.
139
139
140
-
*vtSrc*<br/>
140
+
*`vtSrc`*\
141
141
The `VARTYPE` for the new `_variant_t` object.
142
142
143
-
*fltSrc, dblSrc*<br/>
143
+
*`fltSrc`*, *`dblSrc`*\
144
144
A numerical value to be copied into the new `_variant_t` object.
145
145
146
-
*cySrc*<br/>
146
+
*`cySrc`*\
147
147
A `CY` object to be copied into the new `_variant_t` object.
148
148
149
-
*bstrSrc*<br/>
149
+
*`bstrSrc`*\
150
150
A `_bstr_t` object to be copied into the new `_variant_t` object.
151
151
152
-
*strSrc, wstrSrc*<br/>
152
+
*`strSrc`*, *`wstrSrc`*\
153
153
A string to be copied into the new `_variant_t` object.
154
154
155
-
*bSrc*<br/>
155
+
*`bSrc`*\
156
156
A **`bool`** value to be copied into the new `_variant_t` object.
157
157
158
-
*pIUknownSrc*<br/>
158
+
*`pIUknownSrc`*\
159
159
COM interface pointer to a VT_UNKNOWN object to be encapsulated into the new `_variant_t` object.
160
160
161
-
*pDispSrc*<br/>
161
+
*`pDispSrc`*\
162
162
COM interface pointer to a VT_DISPATCH object to be encapsulated into the new `_variant_t` object.
163
163
164
-
*decSrc*<br/>
164
+
*`decSrc`*\
165
165
A `DECIMAL` value to be copied into the new `_variant_t` object.
166
166
167
-
*bSrc*<br/>
167
+
*`bSrc`*\
168
168
A `BYTE` value to be copied into the new `_variant_t` object.
169
169
170
-
*cSrc*<br/>
170
+
*`cSrc`*\
171
171
A **`char`** value to be copied into the new `_variant_t` object.
172
172
173
-
*usSrc*<br/>
173
+
*`usSrc`*\
174
174
A **`unsigned short`** value to be copied into the new `_variant_t` object.
175
175
176
-
*ulSrc*<br/>
176
+
*`ulSrc`*\
177
177
A **`unsigned long`** value to be copied into the new `_variant_t` object.
178
178
179
-
*iSrc*<br/>
179
+
*`iSrc`*\
180
180
An **`int`** value to be copied into the new `_variant_t` object.
181
181
182
-
*uiSrc*<br/>
182
+
*`uiSrc`*\
183
183
An **`unsigned int`** value to be copied into the new `_variant_t` object.
184
184
185
-
*i8Src*<br/>
185
+
*`i8Src`*\
186
186
An **`__int64`** value to be copied into the new `_variant_t` object.
187
187
188
-
*ui8Src*<br/>
189
-
An **unsigned __int64** value to be copied into the new `_variant_t` object.
188
+
*`ui8Src`*\
189
+
An **`unsigned __int64`** value to be copied into the new `_variant_t` object.
190
190
191
191
## Remarks
192
192
193
-
-**_variant_t( )** Constructs an empty `_variant_t` object, `VT_EMPTY`.
193
+
-**`_variant_t()`** Constructs an empty `_variant_t` object, `VT_EMPTY`.
194
194
195
-
-**_variant_t( VARIANT&***varSrc***)** Constructs a `_variant_t` object from a copy of the `VARIANT` object. The variant type is retained.
195
+
-**`_variant_t( VARIANT&varSrc )`** Constructs a `_variant_t` object from a copy of the `VARIANT` object. The variant type is retained.
196
196
197
-
-**_variant_t( VARIANT**<strong>\*</strong> *pVarSrc***)** Constructs a `_variant_t` object from a copy of the `VARIANT` object. The variant type is retained.
197
+
-**`_variant_t( VARIANT*pVarSrc )`** Constructs a `_variant_t` object from a copy of the `VARIANT` object. The variant type is retained.
198
198
199
-
-**_variant_t( _variant_t&***var_t_Src***)** Constructs a `_variant_t` object from another `_variant_t` object. The variant type is retained.
199
+
-**`_variant_t( _variant_t&var_t_Src )`** Constructs a `_variant_t` object from another `_variant_t` object. The variant type is retained.
200
200
201
-
-**_variant_t( VARIANT&***varSrc***, bool**`fCopy`**)** Constructs a `_variant_t` object from an existing `VARIANT` object. If *fCopy* is **`false`**, the **VARIANT** object is attached to the new object without making a copy.
201
+
-**`_variant_t( VARIANT&varSrc, boolfCopy )`** Constructs a `_variant_t` object from an existing `VARIANT` object. If *`fCopy`* is **`false`**, the **`VARIANT`** object is attached to the new object without making a copy.
202
202
203
-
-**_variant_t( short***sSrc***, VARTYPE**`vtSrc`**= VT_I2 )** Constructs a `_variant_t` object of type VT_I2 or VT_BOOL from a **`short`** integer value. Any other `VARTYPE` results in an E_INVALIDARG error.
203
+
-**`_variant_t( shortsSrc, VARTYPEvtSrc= VT_I2 )`** Constructs a `_variant_t` object of type `VT_I2` or `VT_BOOL` from a **`short`** integer value. Any other `VARTYPE` results in an `E_INVALIDARG` error.
204
204
205
-
-**_variant_t( long**`lSrc`**, VARTYPE**`vtSrc`**= VT_I4 )** Constructs a `_variant_t` object of type VT_I4, VT_BOOL, or VT_ERROR from a **`long`** integer value. Any other `VARTYPE` results in an E_INVALIDARG error.
205
+
-**`_variant_t( longlSrc, VARTYPEvtSrc= VT_I4 )`** Constructs a `_variant_t` object of type `VT_I4`, `VT_BOOL`, or `VT_ERROR` from a **`long`** integer value. Any other `VARTYPE` results in an `E_INVALIDARG` error.
206
206
207
-
-**_variant_t( float**`fltSrc`**)** Constructs a `_variant_t` object of type VT_R4 from a **`float`** numerical value.
207
+
-**`_variant_t( floatfltSrc )`** Constructs a `_variant_t` object of type `VT_R4` from a **`float`** numerical value.
208
208
209
-
-**_variant_t( double**`dblSrc`**, VARTYPE**`vtSrc`**= VT_R8 )** Constructs a `_variant_t` object of type VT_R8 or VT_DATE from a **`double`** numerical value. Any other `VARTYPE` results in an E_INVALIDARG error.
209
+
-**`_variant_t( doubledblSrc, VARTYPEvtSrc= VT_R8 )`** Constructs a `_variant_t` object of type `VT_R8` or `VT_DATE` from a **`double`** numerical value. Any other `VARTYPE` results in an `E_INVALIDARG` error.
210
210
211
-
-**_variant_t( CY&**`cySrc`**)** Constructs a `_variant_t` object of type VT_CY from a `CY` object.
211
+
-**`_variant_t( CY&cySrc )`** Constructs a `_variant_t` object of type `VT_CY` from a `CY` object.
212
212
213
-
-**_variant_t( _bstr_t&**`bstrSrc`**)** Constructs a `_variant_t` object of type VT_BSTR from a `_bstr_t` object. A new `BSTR` is allocated.
213
+
-*`*_variant_t( _bstr_t&bstrSrc )`** Constructs a `_variant_t` object of type `VT_BSTR` from a `_bstr_t` object. A new `BSTR` is allocated.
214
214
215
-
-**_variant_t( wchar_t** <strong>\*</strong> *wstrSrc***)** Constructs a `_variant_t` object of type VT_BSTR from a Unicode string. A new `BSTR` is allocated.
215
+
-**`_variant_t( wchar_t*wstrSrc )`** Constructs a `_variant_t` object of type `VT_BSTR` from a Unicode string. A new `BSTR` is allocated.
216
216
217
-
-**_variant_t( char**<strong>\*</strong> `strSrc`**)** Constructs a `_variant_t` object of type VT_BSTR from a string. A new `BSTR` is allocated.
217
+
-**`_variant_t( char*strSrc )`** Constructs a `_variant_t` object of type `VT_BSTR` from a string. A new `BSTR` is allocated.
218
218
219
-
-**_variant_t( bool**`bSrc`**)** Constructs a `_variant_t` object of type VT_BOOL from a **`bool`** value.
219
+
-**`_variant_t( boolbSrc )`** Constructs a `_variant_t` object of type `VT_BOOL` from a **`bool`** value.
220
220
221
-
-**_variant_t( IUnknown**<strong>\*</strong> `pIUknownSrc`**, bool**`fAddRef`**= true )** Constructs a `_variant_t` object of type VT_UNKNOWN from a COM interface pointer. If `fAddRef` is **`true`**, then `AddRef` is called on the supplied interface pointer to match the call to `Release` that will occur when the `_variant_t` object is destroyed. It is up to you to call `Release` on the supplied interface pointer. If `fAddRef` is **`false`**, this constructor takes ownership of the supplied interface pointer; do not call `Release` on the supplied interface pointer.
221
+
-**`_variant_t( IUnknown*pIUknownSrc, boolfAddRef= true )`** Constructs a `_variant_t` object of type `VT_UNKNOWN` from a COM interface pointer. If `fAddRef` is **`true`**, then `AddRef` is called on the supplied interface pointer to match the call to `Release` that will occur when the `_variant_t` object is destroyed. It is up to you to call `Release` on the supplied interface pointer. If `fAddRef` is **`false`**, this constructor takes ownership of the supplied interface pointer; don't call `Release` on the supplied interface pointer.
222
222
223
-
-**_variant_t( IDispatch**<strong>\*</strong> `pDispSrc`**, bool**`fAddRef`**= true )** Constructs a `_variant_t` object of type VT_DISPATCH from a COM interface pointer. If `fAddRef` is **`true`**, then `AddRef` is called on the supplied interface pointer to match the call to `Release` that will occur when the `_variant_t` object is destroyed. It is up to you to call `Release` on the supplied interface pointer. If `fAddRef` is **`false`**, this constructor takes ownership of the supplied interface pointer; do not call `Release` on the supplied interface pointer.
223
+
-**`_variant_t( IDispatch*pDispSrc, boolfAddRef= true )`** Constructs a `_variant_t` object of type `VT_DISPATCH` from a COM interface pointer. If `fAddRef` is **`true`**, then `AddRef` is called on the supplied interface pointer to match the call to `Release` that will occur when the `_variant_t` object is destroyed. It's up to you to call `Release` on the supplied interface pointer. If `fAddRef` is **`false`**, this constructor takes ownership of the supplied interface pointer; don't call `Release` on the supplied interface pointer.
224
224
225
-
-**_variant_t( DECIMAL&**`decSrc`**)** Constructs a `_variant_t` object of type VT_DECIMAL from a `DECIMAL` value.
225
+
-**`_variant_t( DECIMAL&decSrc )`** Constructs a `_variant_t` object of type `VT_DECIMAL` from a `DECIMAL` value.
226
226
227
-
-**_variant_t( BYTE**`bSrc`**)** Constructs a `_variant_t` object of type `VT_UI1` from a `BYTE` value.
227
+
-**`_variant_t( BYTEbSrc )`** Constructs a `_variant_t` object of type `VT_UI1` from a `BYTE` value.
# Constraints on Generic Type Parameters (C++/CLI)
10
+
# Constraints on generic type parameters (C++/CLI)
11
11
12
-
In generic type or method declarations, you can qualify a type parameter with constraints. A constraint is a requirement that types used as type arguments must satisfy. For example, a constraint might be that the type argument must implement a certain interface or inherit from a specific class.
12
+
In generic type or method declarations, you can qualify a type parameter with *constraints*. A constraint is a requirement that types used as type arguments must satisfy. For example, a constraint might be that the type argument must implement a certain interface or inherit from a specific class.
13
13
14
14
Constraints are optional; not specifying a constraint on a parameter is equivalent to constraining that parameter to <xref:System.Object>.
15
15
16
16
## Syntax
17
17
18
18
```cpp
19
-
where type-parameter: constraintlist
19
+
where type-parameter: constraint-list
20
20
```
21
21
22
22
### Parameters
23
23
24
-
*type-parameter*<br/>
24
+
*`type-parameter`*\
25
25
One of the type parameters, to be constrained.
26
26
27
-
*constraintlist*<br/>
28
-
*constraintlist* is a comma-separated list of constraint specifications. The list can include interfaces to be implemented by the type parameter.
27
+
*`constraint-list`*\
28
+
*`constraint-list`* is a comma-separated list of constraint specifications. The list can include interfaces to be implemented by the type parameter.
29
29
30
30
The list can also include a class. For the type argument to satisfy a base class constraint, it must be the same class as the constraint or derive from the constraint.
31
31
32
-
You can also specify **gcnew()** to indicate the type argument must have a public parameterless constructor; or **ref class** to indicate the type argument must be a reference type, including any class, interface, delegate, or array type; or **value class** to indicate the type argument must be a value type. Any value type except Nullable\<T> can be specified.
32
+
You can also specify **`gcnew()`** to indicate the type argument must have a public parameterless constructor; or **`ref class`** to indicate the type argument must be a reference type, including any class, interface, delegate, or array type; or **`value class`** to indicate the type argument must be a value type. Any value type except `Nullable<T>` can be specified.
33
33
34
-
You can also specify a generic parameter as a constraint. The type argument supplied for the type you are constraining must be or derive from the type of the constraint. This is called a naked type constraint.
34
+
You can also specify a generic parameter as a constraint. The type argument supplied for the type you're constraining must be or derive from the type of the constraint. This parameter is called a *naked type constraint*.
35
35
36
36
## Remarks
37
37
38
-
The constraint clause consists of **where** followed by a type parameter, a colon (**:**), and the constraint, which specifies the nature of the restriction on the type parameter. **where** is a context-sensitive keyword; see [Context-Sensitive Keywords](context-sensitive-keywords-cpp-component-extensions.md) for more information. Separate multiple **where** clauses with a space.
38
+
The constraint clause consists of **`where`** followed by a type parameter, a colon (**`:`**), and the constraint, which specifies the nature of the restriction on the type parameter. **`where`** is a context-sensitive keyword. For more information, see [Context-sensitive keywords](context-sensitive-keywords-cpp-component-extensions.md). Separate multiple **`where`** clauses with a space.
39
39
40
40
Constraints are applied to type parameters to place limitations on the types that can be used as arguments for a generic type or method.
41
41
@@ -54,11 +54,11 @@ ref class List {};
54
54
55
55
This constraint requires that a type argument used for `T` implements `IComparable<T>` at compile time. It also allows interface methods, such as `CompareTo`, to be called. No cast is needed on an instance of the type parameter to call interface methods.
56
56
57
-
Static methods in the type argument's class cannot be called through the type parameter; they can be called only through the actual named type.
57
+
Static methods in the type argument's class can't be called through the type parameter; they can be called only through the actual named type.
58
58
59
-
A constraint cannot be a value type, including built-in types such as **`int`** or **`double`**. Since value types cannot have derived classes, only one class would ever be able to satisfy the constraint. In that case, the generic can be rewritten with the type parameter replaced by the specific value type.
59
+
A constraint can't be a value type, including built-in types such as **`int`** or **`double`**. Since value types cannot have derived classes, only one class could ever satisfy the constraint. In that case, the generic can be rewritten with the type parameter replaced by the specific value type.
60
60
61
-
Constraints are required in some cases since the compiler will not allow the use of methods or other features of an unknown type unless the constraints imply that the unknown type supports the methods or interfaces.
61
+
Constraints are required in some cases since the compiler won't allow the use of methods or other features of an unknown type unless the constraints imply that the unknown type supports the methods or interfaces.
62
62
63
63
Multiple constraints for the same type parameter can be specified in a comma-separated list
To summarize, use constraints in your code according to the following rules:
89
+
Use constraints in your code according to the following rules:
90
90
91
91
- If multiple constraints are listed, the constraints may be listed in any order.
92
92
93
-
- Constraints can also be class types, such as abstract base classes. However, constraints cannot be value types or sealed classes.
93
+
- Constraints can also be class types, such as abstract base classes. However, constraints can't be value types or `sealed` classes.
94
94
95
-
- Constraints cannot themselves be type parameters, but they can involve the type parameters in an open constructed type. For example:
95
+
- Constraints can't themselves be type parameters, but they can involve the type parameters in an open constructed type. For example:
96
96
97
97
```cpp
98
98
// generics_constraints_4.cpp
@@ -167,7 +167,7 @@ int main() {
167
167
"grandfather" is a senior
168
168
```
169
169
170
-
When a generic type parameter is used as a constraint, it is called a naked type constraint. Naked type constraints are useful when a member function with its own type parameter needs to constrain that parameter to the type parameter of the containing type.
170
+
When a generic type parameter is used as a constraint, it's called a *naked type constraint*. Naked type constraints are useful when a member function with its own type parameter needs to constrain that parameter to the type parameter of the containing type.
171
171
172
172
In the following example, `T` is a naked type constraint in the context of the `Add` method.
0 commit comments