For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
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
A COM enumerator ( IEnumXXXX) interface.
A pointer to the interface ID of the enumerator interface.
The type of item exposed by the enumerator interface.
A copy policy class.
An STL container class.
|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.|
|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.|
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.
See CComEnumImpl::Init for details on further differences between
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.
Initializes the enumerator.
HRESULT Init( IUnknown* pUnkForRelease, CollType& collection);
[in] The IUnknown pointer of an object that must be kept alive during the lifetime of the enumerator. Pass NULL if no such object exists.
A reference to the STL container that holds the items to be enumerated.
If you pass
Init a reference to a collection held in another object, you can use the
pUnkForRelease parameter to ensure that the object, and the collection it holds, is available for as long as the enumerator needs it.
You must call this method before passing a pointer to the enumerator interface back to any clients.
This method provides the implementation of the IEnumXXXX::Clone method by creating an object of type
CComEnumOnSTL, initializing it with the same collection and iterator used by the current object, and returning the interface on the newly created object.
[out] The enumerator interface on a newly created object cloned from the current enumerator.
The IUnknown pointer of the object supplying the collection.
This smart pointer maintains a reference on the object passed to IEnumOnSTLImpl::Init, ensuring that it remains alive during the lifetime of the enumerator.
This member points to the collection that provides the data driving the implementation of the enumerator interface.
This member is initialized by a call to IEnumOnSTLImpl::Init.
This member holds the iterator used to mark the current position within the collection and navigate to subsequent elements.
This method provides the implementation of the IEnumXXXX::Next method.
STDMETHOD(Next)(ULONG celt, T* rgelt, ULONG* pceltFetched);
[in] The number of elements requested.
[out] The array to be filled in with the elements.
[out] The number of elements actually returned in
rgelt. This can be less than
celt if fewer than
celt elements remain in the list.
This method provides the implementation of the IEnumXXXX::Reset method.
This method provides the implementation of the IEnumXXXX::Skip method.
[in] The number of elements to skip.