Skip to content

Commit 3572cc9

Browse files
authored
Fix more errors in "Collections (C++/CX)"
1 parent 8965e98 commit 3572cc9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/cppcx/collections-c-cx.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The Windows Runtime defines the interfaces for collections and related types, an
2020
- Iterators are defined in the [`Platform::Collections` Namespace](platform-collections-namespace.md). These iterators satisfy the requirements for STL iterators and enable the use of [`std::find`](../standard-library/algorithm-functions.md#find), [`std::count_if`](../standard-library/algorithm-functions.md#count_if), and other STL algorithms on any [`Windows::Foundation::Collections`](/uwp/api/windows.foundation.collections) interface type or [`Platform::Collections`](platform-collections-namespace.md) concrete type. For example, this means that you can iterate a collection in a Windows Runtime component that's created in C# and apply an STL algorithm to it.
2121

2222
> [!IMPORTANT]
23-
> Proxy iterators `VectorIterator` and `VectorViewIterator` utilize proxy objects `VectoryProxy<T>` and `ArrowProxy<T>` to enable usage with STL containers. For more information, see [VectorProxy elements](#vectorproxy-elements) later in this article.
23+
> Proxy iterators `VectorIterator` and `VectorViewIterator` utilize proxy objects `VectorProxy<T>` and `ArrowProxy<T>` to enable usage with STL containers. For more information, see [VectorProxy elements](#vectorproxy-elements) later in this article.
2424
2525
- The C++/CX collection types support the same thread safety guarantees that STL containers support.
2626

@@ -53,7 +53,7 @@ Any element to be stored in a [`Platform::Collections::Vector`](platform-collect
5353

5454
[`Platform::Collections::VectorIterator`](platform-collections-vectoriterator-class.md) and [`Platform::Collections::VectorViewIterator`](platform-collections-vectorviewiterator-class.md) enable the use of `range for` loops and algorithms like [`std::sort`](../standard-library/algorithm-functions.md#sort) with an [`IVector<T>`](/uwp/api/windows.foundation.collections.ivector-1) container. But `IVector` elements cannot be accessed through C++ pointer dereference; they can be accessed only through [`GetAt`](/uwp/api/windows.foundation.collections.ivector-1.getat) and [`SetAt`](/uwp/api/windows.foundation.collections.ivector-1.setat) methods. Therefore, these iterators use the proxy classes `Platform::Details::VectorProxy<T>` and `Platform::Details::ArrowProxy<T>` to provide access to the individual elements through **`*`**, **`->`**, and **`[]`** operators, as required by the Standard Library. Strictly speaking, given an `IVector<Person^> vec`, the type of `*begin(vec)` is `VectorProxy<Person^>`. However, the proxy object is almost always transparent to your code. These proxy objects are not documented because they are only for internal use by the iterators, but it is useful to know how the mechanism works.
5555

56-
When you use a range-based **`for`** loop over `IVector` containers, use `auto&&` to enable the iterator variable to bind correctly to the `VectorProxy` elements. If you use `auto&`, compiler warning [C4239](../error-messages/compiler-warnings/compiler-warning-level-4-c4239.md) is raised and `VectoryProxy` is mentioned in the warning text.
56+
When you use a range-based **`for`** loop over `IVector` containers, use `auto&&` to enable the iterator variable to bind correctly to the `VectorProxy` elements. If you use `auto&`, compiler warning [C4239](../error-messages/compiler-warnings/compiler-warning-level-4-c4239.md) is raised and `VectorProxy` is mentioned in the warning text.
5757

5858
The following illustration shows a `range for` loop over an `IVector<Person^>`. Notice that execution is stopped on the breakpoint on line 64. The **QuickWatch** window shows that the iterator variable `p` is in fact a `VectorProxy<Person^>` that has `m_v` and `m_i` member variables. However, when you call `GetType` on this variable, it returns the identical type to the `Person` instance `p2`. The takeaway is that although `VectorProxy` and `ArrowProxy` might appear in **QuickWatch**, the debugger certain compiler errors, or other places, you typically don't have to explicitly code for them.
5959

@@ -92,7 +92,7 @@ Elements in a [`Platform::Collections::Map`](platform-collections-map-class.md)
9292
9393
Collections fall into four categories: modifiable versions and read-only versions of sequence collections and associative collections. In addition, C++/CX enhances collections by providing three iterator classes that simplify the accessing of collections.
9494
95-
Elements of a modifiable collection can be changed, but elements of a read-only collection, which is known as a *view*, can only be read. Elements of a [`Platform::Collections::Vector`](platform-collections-vector-class.md) or[`Platform::Collections::VectorView`](platform-collections-vectorview-class.md) collection can be accessed by using an iterator or the collection's [`Vector::GetAt`](platform-collections-vector-class.md#getat) and an index. Elements of an associative collection can be accessed by using the collection's [`Map::Lookup`](platform-collections-map-class.md#lookup) and a key.
95+
Elements of a modifiable collection can be changed, but elements of a read-only collection, which is known as a *view*, can only be read. Elements of a [`Platform::Collections::Vector`](platform-collections-vector-class.md) or [`Platform::Collections::VectorView`](platform-collections-vectorview-class.md) collection can be accessed by using an iterator or the collection's [`Vector::GetAt`](platform-collections-vector-class.md#getat) and an index. Elements of an associative collection can be accessed by using the collection's [`Map::Lookup`](platform-collections-map-class.md#lookup) and a key.
9696
9797
[`Platform::Collections::Map` class](platform-collections-map-class.md)\
9898
A modifiable, associative collection. Map elements are key-value pairs. Looking up a key to retrieve its associated value, and iterating through all key-value pairs, are both supported.
@@ -128,14 +128,14 @@ The following table lists the available iterators and functions.
128128
|[`Platform::Collections::VectorIterator<T>`](platform-collections-vectoriterator-class.md)<br /><br /> (Internally stores [`Windows::Foundation::Collections::IVector<T>`](/uwp/api/windows.foundation.collections.ivector-1) and `int`.)|[`begin`](begin-function.md)/ [`end`](end-function.md)([`Windows::Foundation::Collections::IVector<T>`](/uwp/api/windows.foundation.collections.ivector-1))|
129129
|[`Platform::Collections::VectorViewIterator<T>`](platform-collections-vectorviewiterator-class.md)<br /><br /> (Internally stores [`IVectorView<T>`](/uwp/api/windows.foundation.collections.ivectorview-1)^ and `int`.)|[`begin`](begin-function.md)/ [`end`](end-function.md) ([`IVectorView<T>`](/uwp/api/windows.foundation.collections.ivectorview-1)^)|
130130
|[`Platform::Collections::InputIterator<T>`](platform-collections-inputiterator-class.md)<br /><br /> (Internally stores [`IIterator<T>`](/uwp/api/windows.foundation.collections.iiterator-1)^ and `T`.)|[`begin`](begin-function.md)/ [`end`](end-function.md) ([`IIterable<T>`](/uwp/api/windows.foundation.collections.iiterable-1))|
131-
|[`Platform::Collections::InputIterator<IKeyValuePair<K, V>^>`](platform-collections-inputiterator-class.md)<br /><br /> (Internally stores [`IIterator<T>`](/uwp/api/windows.foundation.collections.iiterator-1)^ and `T`.)|[`begin`](begin-function.md)/ [`end`](end-function.md) ([`IMap<K,V>`](/uwp/api/windows.foundation.collections.imap-2).|
131+
|[`Platform::Collections::InputIterator<IKeyValuePair<K, V>^>`](platform-collections-inputiterator-class.md)<br /><br /> (Internally stores [`IIterator<T>`](/uwp/api/windows.foundation.collections.iiterator-1)^ and `T`.)|[`begin`](begin-function.md)/ [`end`](end-function.md) ([`IMap<K,V>`](/uwp/api/windows.foundation.collections.imap-2))|
132132
|[`Platform::Collections::InputIterator<IKeyValuePair<K, V>^>`](platform-collections-inputiterator-class.md)<br /><br /> (Internally stores [`IIterator<T>`](/uwp/api/windows.foundation.collections.iiterator-1)^ and `T`.)|[`begin`](begin-function.md)/ [`end`](end-function.md) ([`Windows::Foundation::Collections::IMapView`](/uwp/api/windows.foundation.collections.imapview-2))|
133133
134134
### Collection change events
135135
136136
`Vector` and `Map` support databinding in XAML collections by implementing events that occur when a collection object is changed or reset, or when any element of a collection is inserted, removed, or changed. You can write your own types that support databinding, although you cannot inherit from `Map` or `Vector` because those types are sealed.
137137
138-
The [`Windows::Foundation::Collections::VectorChangedEventHandler`](/uwp/api/windows.foundation.collections.vectorchangedeventhandler-1) and [`Windows::Foundation::Collections::MapChangedEventHandler`](/uwp/api/windows.foundation.collections.mapchangedeventhandler-2) delegates specify the signatures for event handlers for collection change events. The [`Windows::Foundation::Collections::CollectionChange`](/uwp/api/windows.foundation.collections.collectionchange) public enum class, and `Platform::Collection::Details::MapChangedEventArgs` and `Platform::Collections::Details::VectorChangedEventArgs` ref classes, store the event arguments to determine what caused the event. The `*EventArgs` types are defined in the `Details` namespace because you don't have to construct or consume them explicitly when you use `Map` or `Vector`.
138+
The [`Windows::Foundation::Collections::VectorChangedEventHandler`](/uwp/api/windows.foundation.collections.vectorchangedeventhandler-1) and [`Windows::Foundation::Collections::MapChangedEventHandler`](/uwp/api/windows.foundation.collections.mapchangedeventhandler-2) delegates specify the signatures for event handlers for collection change events. The [`Windows::Foundation::Collections::CollectionChange`](/uwp/api/windows.foundation.collections.collectionchange) public enum class, and `Platform::Collections::Details::MapChangedEventArgs` and `Platform::Collections::Details::VectorChangedEventArgs` ref classes, store the event arguments to determine what caused the event. The `*EventArgs` types are defined in the `Details` namespace because you don't have to construct or consume them explicitly when you use `Map` or `Vector`.
139139
140140
## See also
141141

0 commit comments

Comments
 (0)