Could you hire me? Contact me if you like what I’ve done in this article and think I can create value for your company with my skills.

May 12, 2006 / by Zsolt Soczó

STL kérdés – tud valaki segíteni?

Itt van ez a gyík egyszerű kód, amiről fogalmam sincs miért nem fordul le. Előre szólok, nem értek az STL-hez, most kezdem ugatni. Vagy ATL? Mondom, értek hozzá. :)

#include "atlbase.h" #include "list"
typedef CComQIPtr CUnknownPtr;
// identity typedef std::list IUnknownList;
void Test()
{  
IUnknownList list;  
CUnknownPtr ptr;  
list.push_back(ptr);
};
A vc8 ezt mondja rá:
cl a.cpp /EHsc
C:Program FilesMicrosoft Visual Studio 8VCINCLUDElist(1163) :
error C2664: 'std::allocator<_Ty>::construct' :
cannot convert parameter 1 from 'IUnknown **' to 'ATL::CComQIPtr *'        
with         [             _Ty=CUnknownPtr         ]        
Types pointed to are unrelated; conversion requires reinterpret_cast,
C-style cast or function-style cast        
C:Program FilesMicrosoft Visual Studio 8VCINCLUDElist(1154) :
while compiling class template member function
'std::_List_nod<_Ty,_Alloc>::_Node *std::list<_Ty>::
_Buynode( std::_List_nod<_Ty,_Alloc>::_Node *,std::_List_nod<_Ty,_Alloc>::_Node *,const _Ty &)'
        with         [             _Ty=CUnknownPtr,             _Alloc=std::allocator         ]        
a.cpp(10) : see reference to class template instantiation 'std::list<_Ty>' being compiled        
with         [             _Ty=CUnknownPtr         ]

Could you hire me? Contact me if you like what I’ve done in this article and think I can create value for your company with my skills.