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
Copy file name to clipboardExpand all lines: Docs/Migrating C++ CX source code to C++ WinRT.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ First let's look at how to get property values. Here's the C++/CX code:
78
78
79
79
auto id = record->XboxUserId;
80
80
81
-
auto state = record->UserState,
81
+
auto state = record->UserState;
82
82
83
83
auto size = record->PresenceDeviceRecords->Size;
84
84
@@ -92,7 +92,7 @@ The equivalent C++/WinRT source code to retrieve the value for a Windows Runtime
92
92
93
93
auto id = record.XboxUserId();
94
94
95
-
auto state = record.UserState(),
95
+
auto state = record.UserState();
96
96
97
97
auto size = record.PresenceDeviceRecords().Size();
98
98
@@ -197,7 +197,7 @@ When we allocate the structure, let's use a different constructor for the 'mySet
197
197
198
198
This change invokes the PropertySet(nullptr\_t) constructor rather than the PropertySet() default constructor. The nullptr\_t constructor does not call into the Windows Runtime to create the backing type. Instead, the 'mySet' field is not connected to any backing object until you assign it a value.
199
199
200
-
Whenever you want to lazily initialize a C++/WinRT class variable, assign nullptr to the value when declaring the instance. Later you can then assign the appropriately constructed object to the variable.
200
+
Whenever you want to lazily initialize a C++/WinRT class variable, assign nullptr to the value when declaring the instance. Later you can assign the appropriately constructed object to the variable.
201
201
202
202
Just say no to 'ref new'
203
203
------------------------
@@ -297,7 +297,7 @@ As described previously, such a field declaration invokes the default constructo
297
297
298
298
But the XboxLiveContext class has no default constructor. It has a constructor that requires a User object parameter to the constructor. And we won't have the necessary User object until later, when we make the assignment to the field.
299
299
300
-
How can I tell the compile to \*not\* use the default constructor? The same as shown previously. Assign nullptr to the field:
300
+
How can I tell the compiler to \*not\* use the default constructor? The same as shown previously. Assign nullptr to the field:
301
301
302
302
```C++
303
303
classSample : . . . {
@@ -603,7 +603,7 @@ to
603
603
task<adapter> const & resultTask
604
604
```
605
605
606
-
Eliminating the hat and const reference changes, already discussed, we simply changed task<XboxSocialRelationShipResult> to task<adapter>.
606
+
Eliminating the hat and const reference changes, already discussed, we simply changed task<XboxSocialRelationshipResult> to task<adapter>.
607
607
608
608
Why? Unfortunately, the current implementation of PPL does not support types without a default constructor. As described previously, many Windows Runtime types do not have a default constructor. As such, the C++/WinRT projection of those types also do not have a default constructor. Therefore, these projected types don't work, as is, with PPL.
0 commit comments