Share via


Platform::Collections 命名空間

Platform::Collections 命名空間包含 MapMapViewVectorVectorView 類別。 這些類別是 Windows::Foundation::Collections 命名空間中定義的相對應介面的具象實作。 實體集合類型無法橫跨 ABI 移植 (例如,當 Javascript 或 C# 程式呼叫 C++ 元件時),但是可以隱含地轉換成對應的介面類型。 例如,如果您實作公用方法來填入和傳回集合,請使用 Platform::Collections::Vector 在內部實作集合,並使用 Windows::Foundation::Collections::IVector 作為傳回類型。 如需詳細資訊,請參閱 集合 在 C++ 中建立Windows 執行階段元件。

您可以從 std::vector 建構 Platform::Collections::Vector,也可以從 std::map 建構 Platform::Collections::Map

此外,Platform::Collections 命名空間也支援反向插入和輸入反覆運算器,以及 VectorVectorView 反覆運算器。

您必須包含 #include collection.h 標頭,才能使用 Platform::Collections 命名空間中的類型。

語法

#include <collection.h>
using namespace Platform::Collections;

成員

這個命名空間包含下列成員。

名稱 描述
Platform::Collections::BackInsertIterator 類別 代表將元素插入集合結尾的迭代器。
Platform::Collections::InputIterator 類別 代表將元素插入集合開頭的迭代器。
Platform::Collections::Map 類別 代表依索引鍵存取的可修改的機碼值組集合。 類似於 std::map
Platform::Collections::MapView 類別 代表依索引鍵存取的唯讀機碼值組集合。
Platform::Collections::Vector 類別 代表可修改的元素序列。 類似於 std::vector
Platform::Collections::VectorIterator 類別 表示周遊 Vector 集合的迭代器。
Platform::Collections::VectorView 類別 代表唯讀元素序列。
Platform::Collections::VectorViewIterator 類別 表示周遊 VectorView 集合的迭代器。

繼承階層

平台命名空間

需求

中繼資料: platform.winmd

命名空間: Platform::Collections

編譯器選項: /ZW

另請參閱

平臺命名空間