diff --git a/docs/build/reference/zo-enhance-optimized-debugging.md b/docs/build/reference/zo-enhance-optimized-debugging.md
index c698def89f3..c4ff8c18fa9 100644
--- a/docs/build/reference/zo-enhance-optimized-debugging.md
+++ b/docs/build/reference/zo-enhance-optimized-debugging.md
@@ -1,7 +1,7 @@
---
description: "Learn more about: /Zo (Enhance Optimized Debugging)"
title: "/Zo (Enhance Optimized Debugging)"
-ms.date: "11/04/2016"
+ms.date: 06/01/2022
f1_keywords: ["-Zo", "/Zo"]
helpviewer_keywords: ["Zo compiler option [C++]", "/Zo compiler option [C++]", "-Zo compiler option [C++]"]
ms.assetid: eea8d89a-7fe0-4fe1-86b2-7689bbebbd7f
@@ -12,17 +12,17 @@ Generate enhanced debugging information for optimized code in non-debug builds.
## Syntax
-```cpp
-/Zo[-]
-```
+> **`/Zo`**\[**`-`**]
## Remarks
-The **/Zo** compiler switch generates enhanced debugging information for optimized code. Optimization may use registers for local variables, reorder code, vectorize loops, and inline function calls. These optimizations can obscure the relationship between the source code and the compiled object code. The **/Zo** switch tells the compiler to generate additional debugging information for local variables and inlined functions. Use it to see variables in the **Autos**, **Locals**, and **Watch** windows when you step through optimized code in the Visual Studio debugger. It also enables stack traces to show inlined functions in the WinDBG debugger. Debug builds that have disabled optimizations ([/Od](od-disable-debug.md)) do not need the additional debugging information generated when **/Zo** is specified. Use the **/Zo** switch to debug Release configurations with optimization turned on. For more information on optimization switches, see [/O Options (Optimize Code)](o-options-optimize-code.md). The **/Zo** option is enabled by default in Visual Studio when you specify debugging information with **/Zi** or **/Z7**. Specify **/Zo-** to explicitly disable this compiler option.
+The **`/Zo`** compiler option generates enhanced debugging information for optimized code. Optimization may use registers for local variables, reorder code, vectorize loops, and inline function calls. These optimizations can obscure the relationship between the source code and the compiled object code. The **`/Zo`** option tells the compiler to generate extra debugging information for local variables and inlined functions. It allows you to see variables in the **Autos**, **Locals**, and **Watch** windows when you step through optimized code in the Visual Studio debugger. It also enables stack traces to show inlined functions in the WinDBG debugger. Debug builds that have disabled optimizations ([`/Od`](od-disable-debug.md)) don't need the extra debugging information generated when **`/Zo`** is specified. Use the **`/Zo`** option to debug Release configurations with optimization turned on. For more information on optimization options, see [`/O` options (Optimize Code)](o-options-optimize-code.md).
-The **/Zo** switch is available starting in Visual Studio 2013 Update 3, and it replaces the previously undocumented **/d2Zi+** switch.
+The **`/Zo`** option is enabled by default when you specify debugging information with **`/Zi`** or **`/Z7`**. It's disabled by the **`/ZI`** compiler option. Specify **`/Zo-`** to explicitly disable this compiler option.
-### To set the /Zo compiler option in Visual Studio
+The **`/Zo`** option is available starting in Visual Studio 2013 Update 3, and it replaces the previously undocumented **`/d2Zi+`** option.
+
+### To set the `/Zo` compiler option in Visual Studio
1. Open the **Property Pages** dialog box for the project. For more information, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
@@ -36,6 +36,6 @@ The **/Zo** switch is available starting in Visual Studio 2013 Update 3, and it
## See also
-[/O Options (Optimize Code)](o-options-optimize-code.md)
-[/Z7, /Zi, /ZI (Debug Information Format)](z7-zi-zi-debug-information-format.md)
+[`/O` Options (Optimize code)](o-options-optimize-code.md)\
+[`/Z7`, `/Zi`, `/ZI` (Debug information format)](z7-zi-zi-debug-information-format.md)\
[Edit and Continue](/visualstudio/debugger/edit-and-continue)
diff --git a/docs/code-quality/c1252.md b/docs/code-quality/c1252.md
index 1e1edee1e3f..300e92597a5 100644
--- a/docs/code-quality/c1252.md
+++ b/docs/code-quality/c1252.md
@@ -1,7 +1,7 @@
---
description: "Learn more about: C1252"
title: C1252
-ms.date: 11/04/2016
+ms.date: 06/01/2022
ms.topic: reference
f1_keywords: ["C1252"]
helpviewer_keywords: ["C1252"]
@@ -9,6 +9,10 @@ ms.assetid: e88bf199-890d-4582-bb5c-c1238797145b
---
# C1252
-> warning C1252: Circular or missing dependency between plugins: requires GUID
+> warning C1252: Circular or missing dependency between plugins: '*plugin-name*' requires GUID '*globally-unique-identifier*'
-The Code Analysis tool reports this warning when there is an internal error with plugin dependencies, not in the code being analyzed.
+The Code Analysis tool reports this warning when there's an internal error in the plugin dependencies. It's not caused by an issue in the code being analyzed.
+
+In some cases, it's possible to work around this issue by disabling the **Enable Code Analysis on Build** property. To disable this build property, open the Property pages dialog for your project. In the **Solution Explorer** window, right-click on the project (not the solution) and select **Properties** in the shortcut menu. Set the **Configuration** to **All Configurations** and the **Platform** to **All Platforms**. Open the **Configuration Properties** > **Code Analysis** > **General** property page. Modify the **Enable Code Analysis on Build** property to **No**. Choose **OK** to save your changes, and then save your project files. Rebuild your project to verify that the issue no longer occurs.
+
+If the issue continues, you can report it to Microsoft. For more information on how to report an issue, see [How to report a problem with the Visual C++ toolset or documentation](../overview/how-to-report-a-problem-with-the-visual-cpp-toolset.md).
diff --git a/docs/cppcx/quick-reference-c-cx.md b/docs/cppcx/quick-reference-c-cx.md
index 1f6b75ac081..b62ceb85310 100644
--- a/docs/cppcx/quick-reference-c-cx.md
+++ b/docs/cppcx/quick-reference-c-cx.md
@@ -1,46 +1,46 @@
---
description: "Learn more about: Quick Reference (C++/CX)"
title: "Quick Reference (C++/CX)"
-ms.date: "12/30/2016"
+ms.date: 05/31/2022
ms.assetid: ba457195-26e5-43aa-b99d-24a871e550f4
---
# Quick Reference (C++/CX)
-The Windows Runtime supports Universal Windows Platform (UWP) apps that execute only in a trustworthy operating system environment, use authorized functions, data types, and devices, and are distributed through the Microsoft Store. The C++/CX simplify the writing of apps for the Windows Runtime. This article is a quick reference; for more complete documentation, see [Type System](../cppcx/type-system-c-cx.md).
+The Windows Runtime supports Universal Windows Platform (UWP) apps. These apps execute only in a trustworthy operating system environment, use authorized functions, data types, and devices, and are distributed through the Microsoft Store. The C++/CX simplify the writing of apps for the Windows Runtime. This article is a quick reference; for more complete documentation, see [Type system](../cppcx/type-system-c-cx.md).
-When you build on the command line, use the **/ZW** compiler option to build a UWP app or Windows Runtime component. To access Windows Runtime declarations, which are defined in the Windows Runtime metadata (.winmd) files, specify the `#using` directive or the **/FU** compiler option. When you create a project for a UWP app, Visual Studio by default sets these options and adds references to all Windows Runtime libraries.
+When you build on the command line, use the **`/ZW`** compiler option to build a UWP app or Windows Runtime component. To access Windows Runtime declarations, which are defined in the Windows Runtime metadata (.winmd) files, specify the `#using` directive or the **`/FU`** compiler option. When you create a project for a UWP app, Visual Studio by default sets these options and adds references to all Windows Runtime libraries.
## Quick reference
-|Concept|Standard C++|C++/CX|Remarks|
-|-------------|--------------------|------------------------------------------------------------------|-------------|
-|Fundamental types|C++ fundamental types.|C++/CX fundamental types that implement fundamental types that are defined in the Windows Runtime.|The `default` namespace contains C++/CX built-in, fundamental types. The compiler implicitly maps C++/CX fundamental types to standard C++ types.
The `Platform` family of namespaces contains types that implement fundamental Windows Runtime types.|
-||**`bool`**|**`bool`**|An 8-bit Boolean value.|
-||**`wchar_t`**, **`char16_t`**|`char16`|A 16-bit nonnumeric value that represents a Unicode (UTF-16) code point.|
-||**`short`**
**`unsigned short`**|`int16`
`uint16`|A 16-bit signed integer.
A 16-bit unsigned integer.|
-||**`int`**
**`unsigned int`**|**`int`**
`uint32`|A 32-bit signed integer.
A 32-bit unsigned integer.|
-||**`long long`** -or- **`__int64`**
**`unsigned long long`**|`int64`
`uint64`|A 64-bit signed integer.
A 64-bit unsigned integer.|
-||**`float`**, **`double`**|`float32, float64`|A 32-bit or 64-bit IEEE 754 floating-point number.|
-||**`enum`**|**`enum class`**
-or-
**`enum struct`**|A 32-bit enumeration.|
-||(Does not apply)|`Platform::Guid`|A 128-bit nonnumeric value (a GUID) in the `Platform` namespace.|
-||`std::time_get`|`Windows::Foundation::DateTime`|A date-time structure.|
-||(Does not apply)|`Windows::Foundation::TimeSpan`|A timespan structure.|
-||(Does not apply)|`Platform::Object^`|The reference-counted base object in the C++ view of the Windows Runtime type system.|
-||`std::wstring`
`L"..."`|`Platform::String^`|`Platform::String^` is a reference-counted, immutable, sequence of Unicode characters that represent text.|
-|Pointer|Pointer to object (`*`):
`std::shared_ptr`|Handle-to-object (`^`, pronounced "hat"):
*T^ identifier*|All Windows Runtime classes are declared by using the handle-to-object modifier. Members of the object are accessed by using the arrow (`->`) class-member-access operator.
The hat modifier means "pointer to a Windows Runtime object that is automatically reference counted." More precisely, handle-to-object declares that the compiler should insert code to automatically manage the object's reference count, and delete the object if the reference count goes to zero.|
-|Reference|Reference to an object (`&`):
*T* `&` *identifier*|Tracking reference (`%`):
*T* `%` *identifier*|Only Windows Runtime types can be declared by using the tracking reference modifier. Members of the object are accessed by using the dot (`.`) class-member-access operator.
The tracking reference means "a reference to a Windows Runtime object that is automatically reference counted." More precisely, a tracking reference declares that the compiler should insert code to automatically manage the object's reference count, and delete the object if the reference count goes to zero.|
-|Dynamic type declaration|`new`|`ref new`|Allocates a Windows Runtime object and then returns a handle to that object.|
-|Object lifetime management|`delete` *identifier*
`delete[]` *identifier*|(Invokes the destructor.)|Lifetime is determined by reference counting. A call to delete invokes the destructor but itself does not free memory.|
-|Array declaration|*T identifier* `[]`
`std::array` *identifier*|`Array<` *T* `^>^` *identifier* `(` *size* `)`
-or-
`WriteOnlyArray<` *T* `^>` *identifier* `(` *size* `)`|Declares a one-dimensional modifiable or write-only array of type T^. The array itself is also a reference-counted object that must be declared by using the handle-to-object modifier.
(Array declarations use a template header class that is in the `Platform` namespace.)|
-|Class declaration|**`class`** *identifier* `{}`
**`struct`** *identifier* `{}`|**`ref class`** *identifier* `{}`
**`ref struct`** *identifier* `{}`|Declares a runtime class that has default private accessibility.
Declares a runtime class that has default public accessibility.|
-|Structure declaration|**`struct`** *identifier* `{}`
(that is, a Plain Old Data structure (POD))|**`value class`** *identifier* `{}`
**`value struct`** *identifier* `{}`|Declares a POD struct that has default private accessibility.
A value class can be represented in Windows metadata, but a standard C++ class cannot be.
Declares a POD struct that has default public accessibility.
A value struct can be represented in Windows metadata, but a standard C++ struct cannot be.|
-|Interface declaration|abstract class that contains only pure virtual functions.|**`interface class`** *identifier* `{}`
**`interface struct`** *identifier* `{}`|Declares an interface that has default private accessibility.
Declares an interface that has default public accessibility.|
-|Delegate|`std::function`|`public delegate` *return-type* *delegate-type-identifier* `(` *[ parameters ]* `);`|Declares an object that can be invoked like a function call.|
-|Event|(Does not apply)|**`event`** *delegate-type-identifier* *event-identifier* `;`
*delegate-type-identifier* *delegate-identifier* = `ref new`*delegate-type-identifier*`( this`*[, parameters]*`);`
*event-identifier* `+=` *delegate-identifier* `;`
-or-
`EventRegistrationToken` *token-identifier* = *obj*`.`*event-identifier*`+=`*delegate-identifier*`;`
-or-
**`auto`** *token-identifier* = *obj*. *event-identifier*`::add(`*delegate-identifier*`);`
*obj* `.` *event-identifier* `-=` *token-identifier* `;`
-or-
*obj* `.` *event-identifier* `::remove(` *token-identifier* `);`|Declares an event object, which stores a collection of event handlers (delegates) that are called when an event occurs.
Creates an event handler.
Adds an event handler.
Adding an event handler returns an event token (*token-identifier*). If you intend to explicitly remove the event handler, you must save the event token for later use.
Removes an event handler.
To remove an event handler, you must specify the event token that you saved when the event handler was added.|
-|Property|(Does not apply)|**`property`** *T* *identifier*;
**`property`** *T* *identifier* `[` *index* `];`
**`property`** *T* `default[` *index* `];`|Declares that a class or object member function is accessed by using the same syntax that's used to access a data member or indexed array element.
Declares a property on a class or object member function.
Declares an indexed property on an object member function.
Declares an indexed property on a class member function.|
-|Parameterized types|templates|`generic interface class` *identifier* `{}`
`generic delegate` *[return-type]* *delegate-identifier* `() {}`|Declares a parameterized interface class.
Declares a parameterized delegate.|
-|Nullable value types|`boost::optional`|[Platform::IBox \](../cppcx/platform-ibox-interface.md)|Enables variables of scalar types and value structs to have a value of **`nullptr`**.|
+| Concept | Standard C++ | C++/CX | Remarks |
+|--|--|--|--|
+| Fundamental types | C++ fundamental types. | C++/CX fundamental types that implement fundamental types that are defined in the Windows Runtime. | The `default` namespace contains C++/CX built-in, fundamental types. The compiler implicitly maps C++/CX fundamental types to standard C++ types.
The `Platform` family of namespaces contains types that implement fundamental Windows Runtime types. |
+| | **`bool`** | **`bool`** | An 8-bit Boolean value. |
+| | **`wchar_t`**, **`char16_t`** | `char16` | A 16-bit nonnumeric value that represents a Unicode (UTF-16) code point. |
+| | **`short`**
**`unsigned short`** | `int16`
`uint16` | A 16-bit signed integer.
A 16-bit unsigned integer. |
+| | **`int`**
**`unsigned int`** | `int`
`uint32` | A 32-bit signed integer.
A 32-bit unsigned integer. |
+| | **`long long`** -or- **`__int64`**
**`unsigned long long`** | `int64`
`uint64` | A 64-bit signed integer.
A 64-bit unsigned integer. |
+| | **`float`**, **`double`** | `float32`, `float64` | A 32-bit or 64-bit IEEE 754 floating-point number. |
+| | **`enum`** | **`enum class`**
-or-
**`enum struct`** | A 32-bit enumeration. |
+| | (Doesn't apply) | `Platform::Guid` | A 128-bit nonnumeric value (a GUID) in the `Platform` namespace. |
+| | `std::time_get` | `Windows::Foundation::DateTime` | A date-time structure. |
+| | (Doesn't apply) | `Windows::Foundation::TimeSpan` | A timespan structure. |
+| | (Doesn't apply) | `Platform::Object^` | The reference-counted base object in the C++ view of the Windows Runtime type system. |
+| | `std::wstring`
`L"..."` | `Platform::String^` | `Platform::String^` is a reference-counted, immutable, sequence of Unicode characters that represent text. |
+| Pointer | Pointer to object (`*`):
`std::shared_ptr` | Handle-to-object (`^`, pronounced "hat"):
`T^ identifier` | All Windows Runtime classes are declared by using the handle-to-object modifier. Members of the object are accessed by using the arrow (`->`) class-member-access operator.
The hat modifier means "pointer to a Windows Runtime object that is automatically reference counted." More precisely, handle-to-object declares that the compiler should insert code to manage the object's reference count automatically, and delete the object if the reference count goes to zero |
+| Reference | Reference to an object (`&`):
`T& identifier` | Tracking reference (`%`):
`T% identifier` | Only Windows Runtime types can be declared by using the tracking reference modifier. Members of the object are accessed by using the dot (`.`) class-member-access operator.
The tracking reference means "a reference to a Windows Runtime object that is automatically reference counted." More precisely, a tracking reference declares that the compiler should insert code to manage the object's reference count automatically. The code deletes the object if the reference count goes to zero. |
+| Dynamic type declaration | `new` | `ref new` | Allocates a Windows Runtime object and then returns a handle to that object. |
+| Object lifetime management | `delete identifier`
`delete[] identifier` | (Invokes the destructor.) | Lifetime is determined by reference counting. A call to `delete` invokes the destructor but itself doesn't free memory. |
+| Array declaration | `T identifier[]`
`std::array identifier` | `Array^ identifier( size )`
-or-
`WriteOnlyArray identifier( size )` | Declares a one-dimensional modifiable or write-only array of type `T^`. The array itself is also a reference-counted object that must be declared by using the handle-to-object modifier.
(Array declarations use a template header class that is in the `Platform` namespace.) |
+| Class declaration | `class identifier {}`
`struct identifier {}` | `ref class identifier {}`
`ref struct identifier {}` | Declares a runtime class that has default `private` accessibility.
Declares a runtime class that has default `public` accessibility. |
+| Structure declaration | `struct identifier {}`
(that is, a Plain Old Data structure (POD)) | `value class identifier {}`
`value struct identifier {}` | Declares a POD struct that has default `private` accessibility.
A `value class` can be represented in Windows metadata, but a standard C++ `class` can't be.
Declares a POD struct that has default `public` accessibility.
A `value struct` can be represented in Windows metadata, but a standard C++ `struct` can't be. |
+| Interface declaration | abstract class that contains only pure virtual functions. | `interface class identifier {}`
`interface struct identifier {}` | Declares an interface that has default `private` accessibility.
Declares an interface that has default `public` accessibility. |
+| Delegate | `std::function` | `public delegate return-type delegate-type-identifier (` *[ parameters ]* `);` | Declares an object that can be invoked like a function call. |
+| Event | (Doesn't apply) | `event delegate-type-identifier event-identifier;`
`delegate-type-identifier delegate-identifier = ref new delegate-type-identifier( this` *[, parameters]* `);`
`event-identifier += *delegate-identifier;`
-or-
`EventRegistrationToken token-identifier = object.event-identifier += delegate-identifier;`
-or-
`auto token-identifier = object.event-identifier::add( delegate-identifier );`
`object.event-identifier -= token-identifier;`
-or-
`object.event-identifier::remove( token-identifier );` | Declares an `event` object, which stores a collection of event handlers (delegates) that are called when an event occurs.
Creates an event handler.
Adds an event handler.
Adding an event handler returns an event token (*`token-identifier`*). If you intend to explicitly remove the event handler, you must save the event token for later use.
Removes an event handler.
To remove an event handler, you must specify the event token that you saved when the event handler was added. |
+| Property | (Doesn't apply) | `property T identifier;`
`property T identifier[ index ];`
`property T default[ index ];` | Declares that a class or object member function is accessed by using the same syntax that's used to access a data member or indexed array element.
Declares a property on a class or object member function.
Declares an indexed property on an object member function.
Declares an indexed property on a class member function. |
+| Parameterized types | templates | `generic interface class identifier {}`
`generic delegate` *[`return-type`]* `delegate-identifier() {}` | Declares a parameterized interface class.
Declares a parameterized delegate. |
+| Nullable value types | `std::optional` | [`Platform::IBox `](../cppcx/platform-ibox-interface.md) | Enables variables of scalar types and `value` structs to have a value of **`nullptr`**. |
## See also
-[C++/CX Language Reference](../cppcx/visual-c-language-reference-c-cx.md)
+[C++/CX language reference](../cppcx/visual-c-language-reference-c-cx.md)
diff --git a/docs/extensions/constraints-on-generic-type-parameters-cpp-cli.md b/docs/extensions/constraints-on-generic-type-parameters-cpp-cli.md
index e36d5db911d..22cc991cbab 100644
--- a/docs/extensions/constraints-on-generic-type-parameters-cpp-cli.md
+++ b/docs/extensions/constraints-on-generic-type-parameters-cpp-cli.md
@@ -1,7 +1,7 @@
---
description: "Learn more about: Constraints on generic type parameters (C++/CLI)"
title: "Constraints on generic type parameters (C++/CLI)"
-ms.date: "10/12/2018"
+ms.date: 06/01/2022
ms.topic: "reference"
f1_keywords: ["where"]
helpviewer_keywords: ["where keyword [C++]", "constraints, C++"]
@@ -11,25 +11,23 @@ ms.assetid: eb828cc9-684f-48a3-a898-b327700c0a63
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.
-Constraints are optional; not specifying a constraint on a parameter is equivalent to constraining that parameter to .
+Constraints are optional; not specifying a constraint on a parameter is equivalent to using a constraint.
## Syntax
-```cpp
-where type-parameter: constraint-list
-```
+> **`where`** *`type-parameter`* **`:`** *`constraint-list`*
### Parameters
*`type-parameter`*\
-One of the type parameters, to be constrained.
+One of the type parameter identifiers to constrain.
*`constraint-list`*\
-*`constraint-list`* is a comma-separated list of constraint specifications. The list can include interfaces to be implemented by the type parameter.
+A comma-separated list of constraint specifications. The list can include interfaces to be implemented by the *`type-parameter`*.
-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.
+The list can also include a class. To satisfy a base class constraint, the type argument must be the same class as the constraint or derive from the constraint. Specify **`ref class`** to indicate the type argument must be a reference type, including any `class`, `interface`, `delegate`, or `array` type. Specify **`value class`** to indicate the type argument must be a value type. Any value type except `Nullable` can be specified.
-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` can be specified.
+You can also specify `gcnew()` to indicate the type argument must have a public parameterless constructor.
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*.
@@ -56,7 +54,7 @@ This constraint requires that a type argument used for `T` implements `IComparab
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.
-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.
+A constraint can't be a value type, including built-in types such as **`int`** or **`double`**. Since value types can't 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.
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.
diff --git a/docs/extensions/generic-functions-cpp-cli.md b/docs/extensions/generic-functions-cpp-cli.md
index 02b61934bbf..ac022d7d72b 100644
--- a/docs/extensions/generic-functions-cpp-cli.md
+++ b/docs/extensions/generic-functions-cpp-cli.md
@@ -1,7 +1,7 @@
---
description: "Learn more about: Generic functions (C++/CLI)"
title: "Generic Functions (C++/CLI)"
-ms.date: "10/12/2018"
+ms.date: 05/31/2022
ms.topic: "reference"
helpviewer_keywords: ["functions [C++], generic", "generic methods", "generics [C++], functions", "methods [C++], generic", "generic functions"]
ms.assetid: 8e409364-58f9-4360-b486-e7d555e0c218
@@ -24,56 +24,84 @@ This feature isn't supported in the Windows Runtime.
### Requirements
-Compiler option: `/ZW`
+Not applicable.
## Common Language Runtime
-A generic function is a function that's declared with type parameters. When called, actual types are used instead of the type parameters.
+A generic function is a function that's declared with generic type parameters. When called, actual types are used instead of the type parameters.
### Syntax
-```cpp
-[attributes] [modifiers]
-return-type identifier
-[type-parameter-constraints-clauses]
+*`generic-declaration`*:\
+ **`generic`** **`<`** *`generic-parameter-list`* **`>`** *`constraint-clause-list`*opt *`function-definition`*
-([formal-parameters])
-{function-body}
-```
+*`generic-parameter-list`*:\
+ *`generic-parameter`*\
+ *`generic-parameter-list`* **`,`** *`generic-parameter`*
-### Parameters
+*`generic-parameter`*:\
+ *`attributes`*opt **`class`** *`identifier`*\
+ *`attributes`*opt **`typename`** *`identifier`*
-*`attributes`*\
-(Optional) Additional declarative information. For more information on attributes and attribute classes, see [attributes](../cppcx/attributes-c-cx.md).
+*`constraint-clause-list`*:\
+ *`constraint-clause-list`*opt *`constraint-clause`*
+
+*`constraint-clause`*:\
+ **`where`** *`identifier`* **`:`** *`constraint-item-list`*
+
+*`constraint-item-list`*:\
+ *`constraint-item`*\
+ *`constraint-item-list`* **`,`** *`constraint-item`*
+
+*`constraint-item`*:\
+ *`type-id`*\
+ **`ref class`**\
+ **`ref struct`**\
+ **`value class`**\
+ **`value struct`**\
+ **`gcnew ( )`**
-*`modifiers`*\
-(Optional) A modifier for the function, such as `static`. **`virtual`** isn't allowed since virtual methods may not be generic.
+*`generic-id`*:\
+ *`generic-name`* **`<`** *`generic-argument-list`* **`>`**
-*`return-type`*\
-The type returned by the method. If the return type is void, no return value is required.
+*`generic-name`*:\
+ *`identifier`*\
+ *`operator-function-id`*
-*`identifier`*\
-The function name.
+*`generic-argument-list`*:\
+ *`generic-argument`*\
+ *`generic-argument-list`* **`,`** *`generic-argument`*
+
+*`generic-argument`*:\
+ *`type-id`*
+
+### Parameters
+
+*`generic-parameter-list`*\
+A comma-separated list of optionally attributed generic type parameter identifiers.
+
+*`attributes`*\
+(Optional) Extra declarative information. For more information on attributes and attribute classes, see [attributes](../cppcx/attributes-c-cx.md).
-*`type-parameter-identifier-list`*\
-Comma-separated identifiers list.
+*`constraint-clause-list`*\
+This optional list specifies restrictions on the types that may be used as type arguments. It takes the form specified in [Constraints on generic type parameters (C++/CLI)](constraints-on-generic-type-parameters-cpp-cli.md).
-*`formal-parameters`*\
-(Optional) Parameter list.
+*`function-definition`*\
+A definition of a method or standalone function. The function may not have a `virtual` modifier, which isn't allowed since virtual methods may not be generic. The body of the function may refer to the generic type parameter identifiers. The function may be an `operator` function.
-*`type-parameter-constraints-clauses`*\
-This set specifies restrictions on the types that may be used as type arguments, and takes the form specified in [Constraints on Generic Type Parameters (C++/CLI)](constraints-on-generic-type-parameters-cpp-cli.md).
+*`generic-id`*\
+When you invoke an instance of a generic function, you specify the types used to implement it in the *`generic-argument-list`*. This list corresponds to the *`generic-parameter-list`*, and must satisfy the constraints of the optional *`constraint-clause-list`*.
-*`function-body`*\
-The body of the method, which may refer to the type parameter identifiers.
+*`generic-name`*\
+A generic function may have an *`identifier`* as its name, or it may be an `operator` function.
### Remarks
-Generic functions are functions declared with a generic type parameter. They may be methods in a `class` or `struct`, or standalone functions. A single generic declaration implicitly declares a family of functions that differ only in the substitution of a different actual type for the generic type parameter.
+Generic functions are functions declared with one or more generic type parameters. They may be methods in a `class` or `struct`, or standalone functions. A single generic declaration implicitly declares a family of functions that differ only in the substitution of a different actual type for the generic type parameter.
A `class` or `struct` constructor may not be declared with generic type parameters.
-When called, the generic type parameter is replaced by an actual type. The actual type may be explicitly specified in angled brackets using syntax similar to a template function call. If called without the type parameters, the compiler will attempt to deduce the actual type from the parameters supplied in the function call. The compiler reports an error if the intended type argument cannot be deduced from the parameters used.
+When called, the generic type parameter is replaced by an actual type. The actual type may be explicitly specified in angled brackets using syntax similar to a template function call. If called without the type parameters, the compiler will attempt to deduce the actual type from the parameters supplied in the function call. The compiler reports an error if the intended type argument can't be deduced from the parameters used.
### Requirements