Condividi tramite


collection_adapter (STL/CLR)

The template class describes an object that wraps a BCL interface as a simple STL/CLR container. You use it to obtain an iterator pair that lets you manipulate the controlled sequence.

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>>;

Parameters

  • Coll
    The type of the wrapped collection.

Specializations

Specialization

Description

IEnumerable

Sequence through elements.

ICollection

Maintain group of elements.

IList

Maintain an ordered group of elements.

IDictionary

Maintain a set of {key, value} pairs.

IEnumerable<Value>

Sequence through typed elements.

ICollection<Value>

Maintain group of typed elements.

IList<Value>

Maintain ordered group of typed elements.

IDictionary<Value>

Maintain a set of typed {key, value} pairs.

Members

Type Definition

Description

collection_adapter::difference_type (STL/CLR)

The type of a signed distance between two elements.

collection_adapter::iterator (STL/CLR)

The type of an iterator for the controlled sequence.

collection_adapter::key_type (STL/CLR)

The type of a dictionary key.

collection_adapter::mapped_type (STL/CLR)

The type of a dictionary value.

collection_adapter::reference (STL/CLR)

The type of a reference to an element.

collection_adapter::size_type (STL/CLR)

The type of a signed distance between two elements.

collection_adapter::value_type (STL/CLR)

The type of an element.

Member Function

Description

collection_adapter::base (STL/CLR)

Designates the wrapped BCL interface.

collection_adapter::begin (STL/CLR)

Designates the beginning of the controlled sequence.

collection_adapter::collection_adapter (STL/CLR)

Constructs an adapter object.

collection_adapter::end (STL/CLR)

Designates the end of the controlled sequence.

collection_adapter::size (STL/CLR)

Counts the number of elements.

collection_adapter::swap (STL/CLR)

Swaps the contents of two containers.

Operator

Description

collection_adapter::operator= (STL/CLR)

Replaces the stored BCL handle.

Remarks

The object stores a handle to a BCL interface, which in turn controls a sequence of elements. From an object X you can obtain a pair of input iterators X.begin() and X.end() that let you visit the elements, in order, following the usual STL/CLR idioms. Some of the specializations also let you write X.size() to determine the length of the controlled sequence. You use this template class to manipulate BCL containers much like STL/CLR containers.

Requirements

Header: <cliext/adapter>

Namespace: cliext

See Also

Concepts

range_adapter (STL/CLR)

make_collection (STL/CLR)