collection_adapter (STL/CLR)

包装 .NET 集合用作 STL/CLR 容器。 collection_adapter 是描述一个简单的 STL/CLR 容器对象的模板类。 它将一个基类库 (BCL)接口,并返回迭代器对用于操作控件序列。

template<typename Coll>
    ref class collection_adapter;

template<>
    ref class collection_adapter<
        System::Collections::ICollection>;
template<>
    ref class collection_adapter<
        System::Collections::IEnumerable>;
template<>
    ref class collection_adapter<
        System::Collections::IList>;
template<>
    ref class collection_adapter<
        System::Collections::IDictionary>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::ICollection<Value>>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IEnumerable<Value>>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IList<Value>>;
template<typename Key,
    typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IDictionary<Key, Value>>;

参数

  • Coll
    包装的集合的类型。

专用化

专用化

说明

IEnumerable

顺序排列元素。

ICollection

维护一组元素。

IList

维护元素的已排序的组。

IDictionary

维护设置 {,} 键值对。

IEnumerable<值>

顺序排列类型元素。

ICollection<值>

维护类型元素的一组。

IList<值>

维护类型元素的已排序的组。

IDictionary<值>

维护一组键入 {,} 键值对。

成员

类型定义

说明

collection_adapter::difference_type (STL/CLR)

带符号距离的类型两个元素间的。

collection_adapter::iterator (STL/CLR)

一个迭代器类型的控制序列的。

collection_adapter::key_type (STL/CLR)

字典键的类型。

collection_adapter::mapped_type (STL/CLR)

字典值的类型。

collection_adapter::reference (STL/CLR)

引用的类型的元素。

collection_adapter::size_type (STL/CLR)

带符号距离的类型两个元素间的。

collection_adapter::value_type (STL/CLR)

元素的类型。

成员函数

说明

collection_adapter::base (STL/CLR)

指定包装 BCL 接口。

collection_adapter::begin (STL/CLR)

指定受控序列的开头。

collection_adapter::collection_adapter (STL/CLR)

构造适配器对象。

collection_adapter::end (STL/CLR)

指定受控序列的末尾。

collection_adapter::size (STL/CLR)

计算元素的数量。

collection_adapter::swap (STL/CLR)

交换两个容器的内容。

运算符

说明

collection_adapter::operator= (STL/CLR)

替换存储的 BCL 处理。

备注

可以使用此模板类操作 BCL 容器作为 STL/CLR 容器。 collection_adapter 存储的句柄。 BCL 接口,而该控件元素序列。 collection_adapter 对象 X 返回输入迭代器使用访问元素的 X.begin() 和 X.end() 对,按顺序。 某些专用化还可以编写 X.size() 确定控件序列的长度。

要求

标题: <cliext/适配器>

命名空间: cliext

请参见

参考

range_adapter (STL/CLR)

make_collection (STL/CLR)