How to retrieve object pointer from ATL collection of objects?
问题 I have a collection of objects that is defined as: typedef IField ItemInterface; typedef CComObject<CField>* ItemClassPtr; typedef CAdapt< CComPtr<ItemInterface> > ItemType; typedef std::vector< ItemType > ContainerType; and I have created several of the CField objects via a series of calls (ignoring hresult): IField* ppField = 0; hresult = CField::CreateInstance(&ppField); ItemType spField = ppField; m_coll.push_back(spField); ppField->Release(); and now I'm trying to retrieve a pointer to