Export (0) Print
Expand All

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.

ATL Collection and Enumerator Classes

Briefly describes and provides links to the ATL classes that will help you implement collections and enumerators.

Design Principles for Collection and Enumerator Interfaces

Discusses the different design principles behind each type of interface.

Implementing an STL-Based Collection

An extended example that walks you through the implementation of a Standard Template Library (STL)-based collection.

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.

Show:
© 2014 Microsoft