Condividi tramite


IEnumOnSTLImpl Class

This class defines an enumerator interface based on an STL collection.

template < 
   class Base, 
   const IID* piid, 
   class T, 
   class Copy, 
   class CollType 
> 
class ATL_NO_VTABLE IEnumOnSTLImpl : 
   public Base

Parameters

  • Base
    A COM enumerator (IEnumXXXX) interface.

  • piid
    A pointer to the interface ID of the enumerator interface.

  • T
    The type of item exposed by the enumerator interface.

  • Copy
    A copy policy class.

  • CollType
    An STL container class.

Members

Public Methods

Name

Description

IEnumOnSTLImpl::Clone

The implementation of IEnumXXXX::Clone.

IEnumOnSTLImpl::Init

Initializes the enumerator.

IEnumOnSTLImpl::Next

The implementation of IEnumXXXX::Next.

IEnumOnSTLImpl::Reset

The implementation of IEnumXXXX::Reset.

IEnumOnSTLImpl::Skip

The implementation of IEnumXXXX::Skip.

Public Data Members

Name

Description

IEnumOnSTLImpl::m_iter

The iterator that represents the enumerator's current position within the collection.

IEnumOnSTLImpl::m_pcollection

A pointer to the STL container holding the items to be enumerated.

IEnumOnSTLImpl::m_spUnk

The IUnknown pointer of the object supplying the collection.

Remarks

IEnumOnSTLImpl provides the implementation for a COM enumerator interface where the items being enumerated are stored in an STL-compatible container. This class is analogous to the CComEnumImpl class, which provides an implementation for an enumerator interface based on an array.

Note

See CComEnumImpl::Init for details on further differences between CComEnumImpl and IEnumOnSTLImpl.

Typically, you will not need to create your own enumerator class by deriving from this interface implementation. If you want to use an ATL-supplied enumerator based on an STL container, it is more common to create an instance of CComEnumOnSTL, or to create a collection class that returns an enumerator by deriving from ICollectionOnSTLImpl.

However, if you do need to provide a custom enumerator (for example, one that exposes interfaces in addition to the enumerator interface), you can derive from this class. In this situation it is likely that you'll need to override the Clone method to provide your own implementation.

Inheritance Hierarchy

Base

IEnumOnSTLImpl

Requirements

Header: atlcom.h

See Also

Other Resources

ATL Class Overview