Skip to content

Commit

Permalink
Merge pull request MicrosoftDocs#198 from Microsoft/mb-cppcx2
Browse files Browse the repository at this point in the history
fixes in cpp-cx box topic
  • Loading branch information
ghogen authored Mar 21, 2017
2 parents 1d94917 + e28d8e7 commit 2d7c5c3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 40 deletions.
7 changes: 7 additions & 0 deletions docs/cpp-conformance-improvements-2017.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ namespace
}
```

### Classes declared in anonymous namespaces
According to the C++ standard, a class declared inside an anonymous namespace has internal linkage, and therefore cannot be exported. In Visual Studio 2015 and earlier, this rule was not enforced. In Visual Studio 2017 the rule is partially enforced. The following example raises this error in Visual Studio 2017: "error C2201: 'const `anonymous namespace'::S1::`vftable'': must have external linkage in order to be exported/imported."

```cpp
struct __declspec(dllexport) S1 { virtual void f() {} }; //C2201
```
### Default initializers for value class members (C++/CLI)
In Visual Studio 2015 and earlier, the compiler permitted (but ignored) a default member initializer for a member of a value class. Default initialization of a value class always zero-initializes the members; a default constructor is not permitted. In Visual Studio 2017, default member initializers raise a compiler error, as shown in this example:
Expand Down
61 changes: 22 additions & 39 deletions docs/cppcx/platform-box-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@ ref class Box abstract;
**Header:** vccorlib.h
**Namespace:** Platform
## Box::Box Constructor
Creates a `Box` that can encapsulate a value of the specified type.
|Member|Description|
|------------|-----------------|
|[Box Constructor](#ctor)|Creates a `Box` that can encapsulate a value of the specified type.|
|[operator Box&lt;const T&gt;^](#box-const-t)|Enables boxing conversions from a `const` value class `T` or `enum` class `T` to `Box<T>`.|
|[operator Box&lt;const volatile T&gt;^](#box-const-volatile-t)|Enables boxing conversions from a `const volatile` value class `T` or `enum` type `T` to `Box<T>`. |
|[operator Box&lt;T&gt;^](#box-t)|Enables boxing conversions from a value class `T` to `Box<T>`.|
|[operator Box&lt;volatile T&gt;^](#box-volatile-t)|Enables boxing conversions from a `volatile` value class `T` or `enum` type `T` to `Box<T>`.|
|[Box::operator T](#t)|Enables boxing conversions from a value class `T` or `enum` class `T` to `Box<T>`.|
## <a name="ctor"></a> Box::Box Constructor
Creates a `Box` that can encapsulate a value of the specified type.|
|[Value property](#value)|Returns the value that is encapsulated in the `Box` object.|
### Syntax
```cpp
Expand All @@ -47,7 +54,7 @@ Box(T valueArg);
The type of value to be boxed—for example, `int`, `bool`, `float64`, `DateTime`.


## Box::operator Box&lt;const T&gt;^ Operator
## <a name="box-const-t"></a> Box::operator Box&lt;const T&gt;^ Operator
Enables boxing conversions from a `const` value class `T` or `enum` class `T` to `Box<T>`.

### Syntax
Expand All @@ -61,14 +68,9 @@ operator Box<const T>^(const T valueType);
Any value class, value struct, or enum type. Includes the built-in types in the [default namespace](../cppcx/default-namespace.md).

### Return Value
A `Platform::Box<T>``^` instance that represents the original value boxed in a ref class.
A `Platform::Box<T>^` instance that represents the original value boxed in a ref class.





---
## Box::operator Box&lt;const volatile T&gt;^ Operator
## <a name="box-const-volatile-t"></a> Box::operator Box&lt;const volatile T&gt;^ Operator
Enables boxing conversions from a `const volatile` value class `T` or `enum` type `T` to `Box<T>`.

### Syntax
Expand All @@ -82,14 +84,9 @@ operator Box<const volatile T>^(const volatile T valueType);
Any enum type, value class, or value struct. Includes the built-in types in the [default namespace](../cppcx/default-namespace.md).

### Return Value
A `Platform::Box<T>``^` instance that represents the original value boxed in a ref class.
A `Platform::Box<T>^` instance that represents the original value boxed in a ref class.





---
## Box::operator Box&lt;T&gt;^ Operator
## <a name="box-t"></a> Box::operator Box&lt;T&gt;^ Operator
Enables boxing conversions from a value class `T` to `Box<T>`.

### Syntax
Expand All @@ -103,14 +100,9 @@ operator Box<const T>^(const T valueType);
Any enum type, value class, or value struct. Includes the built-in types in the [default namespace](../cppcx/default-namespace.md).

### Return Value
A `Platform::Box<T>``^` instance that represents the original value boxed in a ref class.
A `Platform::Box<T>^` instance that represents the original value boxed in a ref class.





---
## Box::operator Box&lt;volatile T&gt;^ Operator
## <a name="box-volatile-t"></a> Box::operator Box&lt;volatile T&gt;^ Operator
Enables boxing conversions from a `volatile` value class `T` or `enum` type `T` to `Box<T>`.

### Syntax
Expand All @@ -124,14 +116,9 @@ operator Box<volatile T>^(volatile T valueType);
Any enum type, value class, or value struct. Includes the built-in types in the [default namespace](../cppcx/default-namespace.md).

### Return Value
A `Platform::Box<T>``^` instance that represents the original value boxed in a ref class.
A `Platform::Box<T>^` instance that represents the original value boxed in a ref class.





---
## Box::operator T Operator
## <a name="t"></a> Box::operator T Operator
Enables boxing conversions from a value class `T` or `enum` class `T` to `Box<T>`.

### Syntax
Expand All @@ -145,14 +132,10 @@ operator Box<T>^(T valueType);
Any enum type, value class, or value struct. Includes the built-in types in the [default namespace](../cppcx/default-namespace.md).

### Return Value
A `Platform::Box<T>``^` instance that represents the original value boxed in a ref class.
A `Platform::Box<T>^` instance that represents the original value boxed in a ref class.





---
## Box::Value Property
## <a name="value"></a> Box::Value Property
Returns the value that is encapsulated in the `Box` object.

### Syntax
Expand Down
2 changes: 1 addition & 1 deletion docs/cppcx/platform-string-class.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ref class String sealed : Object,
**Properties**
The String class has the following properties.
The String class has the following operators.
|Member|Description|
|------------|-----------------|
Expand Down

0 comments on commit 2d7c5c3

Please sign in to comment.