代码改变世界

ATL中集合和枚举器

2011-06-15 20:37  Clingingboy  阅读(1039)  评论(0编辑  收藏  举报

 

一.实现枚举器

typedef std::vector< std::string >                ContainerType;
typedef VCUE::GenericCopy<VARIANT, ContainerType::value_type>        EnumeratorCopyType;
typedef CComEnumOnSTL< IEnumVARIANT, &__uuidof(IEnumVARIANT), VARIANT,
                        EnumeratorCopyType, ContainerType > EnumeratorType;

二.实现ICollection

typedef VCUE::GenericCopy<BSTR, ContainerType::value_type>        CollectionCopyType;
typedef ICollectionOnSTLImpl<IWords, ContainerType,BSTR,
                        CollectionCopyType,EnumeratorType> CollectionType;

 

参考:
http://blog.csdn.net/nelsonc/archive/2003/07/15/10860.aspx
http://www.cppblog.com/Robertxiao/archive/2008/10/05/63275.html

 

image