Udostępnij za pośrednictwem


ATL Collections and Enumerators

A collection is a COM object that provides an interface that allows access to a group of data items (raw data or other objects). An interface that follows the standards for providing access to a group of objects is known as a collection interface.

At a minimum, collection interfaces must provide a Count property that returns the number of items in the collection, an Item property that returns an item from the collection based on an index, and a _NewEnum property that returns an enumerator for the collection. Optionally, collection interfaces can provide Add and Remove methods to allow items to be inserted into or deleted from the collection, and a Clear method to remove all items.

An enumerator is a COM object that provides an interface for iterating through items in a collection. Enumerator interfaces provide serial access to the elements of a collection via four required methods: Next, Skip, Reset, and Clone.

You can learn more about enumerator interfaces by reading about the archetypal (but entirely imaginary) IEnumXXXX interface.

In This Section

  • ATL
    Provides links to conceptual topics on how to program using the Active Template Library.

  • ATLCollections Sample
    A sample that demonstrates the use of ICollectionOnSTLImpl and CComEnumOnSTL, and the implementation of custom copy policy classes.

See Also

Other Resources

ATL Concepts