Re: Can i use CComPtr in CSimplemap?
I use it like this way:
CSimpleMap.Add didn't zero the memeory it realloc'd:
BOOL Add(TKey key, TVal val)
pKey = (TKey*)realloc(m_aKey, (m_nSize + 1) * sizeof(TKey));
if(pKey == NULL)
and here, CSimpleMap use the newer alloc'd object's address:
void SetAtIndex(int nIndex, TKey& key, TVal& val)
ATLASSERT(nIndex >= 0 && nIndex < m_nSize);
but CComPtr cannot use it's address if it's member 'p' isn't null
//The assert on operator& usually indicates a bug. If this is really
//what is needed, however, take the address of the p member explicitly.
So, i have to use plain pointer instead of smart pointer with CSimpleMap.
Could you give me some ideas?
"Igor Tandetnik" <firstname.lastname@example.org> ????????
"wtller" <email@example.com> wrote in message
like this: CSimpleMap<CComPtr<IUnknown>,int>
Yes, this should work. Have you tried it and encountered problems?
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925