| title | Platform::Collections Namespace | Microsoft Docs | |
|---|---|---|
| ms.custom | ||
| ms.date | 01/25/2017 | |
| ms.technology | cpp-windows | |
| ms.reviewer | ||
| ms.suite | ||
| ms.tgt_pltfrm | ||
| ms.topic | language-reference | |
| f1_keywords |
|
|
| dev_langs |
|
|
| helpviewer_keywords |
|
|
| ms.assetid | b5042864-5f22-40b7-b7a5-c0691f65cc47 | |
| caps.latest.revision | 9 | |
| author | ghogen | |
| ms.author | ghogen | |
| manager | ghogen |
The Platform::Collection namespace contains the Map, MapView, Vector, and VectorView classes. These classes are concrete implementations of the corresponding interfaces that are defined in the Windows::Foundation::Collections namespace. The concrete collection types are not portable across the ABI (for example when a Javascript or C# program calls into a C++ component), but they are implicitly convertible to their corresponding interface types. For example, if you implement a public method that populates and returns a collection, then use Platform::Collections::Vector to implement the collection internally and use Windows::Foundation::Collections::IVector as the return type. For more information, see Collections and Creating Windows Runtime Components in C++.
You can construct a Platform::Collections::Vector from a std::vector and a Platform::Collections::Map from a std::map.
In addition, the Platform::Collection namespace provides support for back insert and input iterators, and Vector and VectorView iterators.
You must include (#include) the collection.h header to use the types in the Platform::Collection namespace.
#include <collection.h>
using namespace Platform::Collection; This namespace contains the following members.
| Name | Description |
|---|---|
| Platform::Collections::BackInsertIterator Class | Represents an iterator that inserts an element at the end of a collection. |
| Platform::Collections::InputIterator Class | Represents an iterator that inserts an element at the beginning of a collection. |
| Platform::Collections::Map Class | Represents a modifiable collection of key-value pairs that are accessed by a key. Similar to std::map. |
| Platform::Collections::MapView Class | Represents a read-only collection of key-value pairs that are accessed by a key. |
| Platform::Collections::Vector Class | Represents a modifiable sequence of elements. Similar to std::vector. |
| Platform::Collections::VectorIterator Class | Represents an iterator that traverses a Vector collection. |
| Platform::Collections::VectorView Class | Represents a read-only sequence of elements. |
| Platform::Collections::VectorViewIterator Class | Represents an iterator that traverses a VectorView collection. |
Metadata: platform.winmd
Namespace: Platform::Collections
Compiler option: /ZW