Hi, On 1/8/07, Trent Nelson wrote:
Philipp Henkel wrote:
I would like to discuss some code I'm using to manage COM objects with intrusive_ptr.
Out of interest, what's your motivation for using intrusive_ptr over the smart pointer facilities (via #import of your COM DLL/EXE) provided by Visual Studio?
Internally the CComPtr often casts its raw pointer to IUnknown. That's no problem as long as you are using the CComPtr with COM interface classes only. Unfortunately I need a smart pointer for my implementation classes, too. Casts to IUnknown are ambiguous if the class implements two or more COM interfaces (dreaded diamond inheritance hierarchy) and therefore I thought about using another smart pointer. Additionally I'm not big fan of COM and that's why I prefer a lightweight reference counting solution like intrusive_ptr to handle my COM stuff. You'd lose the benefits of
things like IntelliSense completion for COM types if you wrolled your own wrapper, I would think.
That's not a problem. I'm using another code completion tool for VS. :-) Best regards, Philipp